diff --git a/src/Commands/DisableCommand.php b/src/Commands/DisableCommand.php index b28f381..44e9f90 100644 --- a/src/Commands/DisableCommand.php +++ b/src/Commands/DisableCommand.php @@ -31,6 +31,6 @@ public function handle() $this->hooks->disable($name); - $this->info("Hook [{$name}] have been disabled."); + $this->info("Hook [{$name}] has been disabled."); } } diff --git a/src/Commands/EnableCommand.php b/src/Commands/EnableCommand.php index 9f942a5..3ab9c91 100644 --- a/src/Commands/EnableCommand.php +++ b/src/Commands/EnableCommand.php @@ -31,6 +31,6 @@ public function handle() $this->hooks->enable($name); - $this->info("Hook [{$name}] have been enabled."); + $this->info("Hook [{$name}] has been enabled."); } } diff --git a/src/Commands/InstallCommand.php b/src/Commands/InstallCommand.php index b671f0e..9f5f000 100644 --- a/src/Commands/InstallCommand.php +++ b/src/Commands/InstallCommand.php @@ -40,9 +40,9 @@ public function handle() if ($this->option('enable')) { $this->hooks->enable($name); - $this->info("Hook [{$name}] have been installed and enabled."); + $this->info("Hook [{$name}] has been installed and enabled."); } else { - $this->info("Hook [{$name}] have been installed."); + $this->info("Hook [{$name}] has been installed."); } } } diff --git a/src/Commands/MakeCommand.php b/src/Commands/MakeCommand.php index f45d420..b1fed68 100644 --- a/src/Commands/MakeCommand.php +++ b/src/Commands/MakeCommand.php @@ -3,6 +3,7 @@ namespace Larapack\Hooks\Commands; use Illuminate\Console\Command; +use Illuminate\Support\Str; use Larapack\Hooks\Hooks; class MakeCommand extends Command @@ -28,10 +29,10 @@ public function fire() public function handle() { $name = $this->argument('name'); - $name = kebab_case($name); + $name = Str::kebab($name); $this->hooks->make($name); - $this->info("Hook [{$name}] have been made."); + $this->info("Hook [{$name}] has been made."); } } diff --git a/src/Commands/SetupCommand.php b/src/Commands/SetupCommand.php index 61d7385..46c034b 100644 --- a/src/Commands/SetupCommand.php +++ b/src/Commands/SetupCommand.php @@ -4,6 +4,7 @@ use Illuminate\Console\Command; use Illuminate\Filesystem\Filesystem; +use Illuminate\Support\Str; use Larapack\Hooks\Composer; use Larapack\Hooks\Events\Setup; use Larapack\Hooks\HooksServiceProvider; @@ -39,7 +40,7 @@ public function handle() 'url' => $this->option('url'), ]); - if (starts_with($this->option('url'), 'http://')) { + if (Str::startsWith($this->option('url'), 'http://')) { $composer->addConfig('secure-http', false); } diff --git a/src/Commands/UninstallCommand.php b/src/Commands/UninstallCommand.php index 8db6449..1be705e 100644 --- a/src/Commands/UninstallCommand.php +++ b/src/Commands/UninstallCommand.php @@ -37,6 +37,6 @@ public function handle() !$this->option('no-unpublish') ); - $this->info("Hook [{$name}] have been uninstalled."); + $this->info("Hook [{$name}] has been uninstalled."); } } diff --git a/src/Commands/UpdateCommand.php b/src/Commands/UpdateCommand.php index 1dd73e2..4ea4fe2 100644 --- a/src/Commands/UpdateCommand.php +++ b/src/Commands/UpdateCommand.php @@ -45,7 +45,7 @@ public function handle() ); return $updated - ? $this->info("Hook [{$name}] have been updated!") + ? $this->info("Hook [{$name}] has been updated!") : $this->info('Nothing to update.'); } } diff --git a/src/Hook.php b/src/Hook.php index 80f3c44..95948cf 100644 --- a/src/Hook.php +++ b/src/Hook.php @@ -5,6 +5,7 @@ use ArrayAccess; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Filesystem\Filesystem; +use Illuminate\Support\Str; class Hook implements ArrayAccess, Arrayable { @@ -128,7 +129,7 @@ public function mergeWithJson($path) public function setAttribute($key, $value) { - $method = camel_case('set_'.$key.'_attribute'); + $method = Str::camel('set_'.$key.'_attribute'); if (method_exists($this, $method)) { return $this->$method($value); @@ -139,7 +140,7 @@ public function setAttribute($key, $value) public function getAttribute($key) { - $method = camel_case('get_'.$key.'_attribute'); + $method = Str::camel('get_'.$key.'_attribute'); if (method_exists($this, $method)) { return $this->$method(); diff --git a/src/Hooks.php b/src/Hooks.php index b2c75fa..3590550 100644 --- a/src/Hooks.php +++ b/src/Hooks.php @@ -5,6 +5,8 @@ use Carbon\Carbon; use Illuminate\Filesystem\Filesystem; use Illuminate\Foundation\Application; +use Illuminate\Support\Arr; +use Illuminate\Support\Str; use Symfony\Component\Console\Input\ArrayInput; class Hooks @@ -478,7 +480,7 @@ public function disable($name) */ public function make($name) { - $studlyCase = studly_case($name); + $studlyCase = Str::studly($name); // Check if already exists if ($this->downloaded($name)) { @@ -506,9 +508,9 @@ protected function makeStubFiles($name) { $replaces = [ 'kebab-case' => $name, - 'snake_case' => snake_case(str_replace('-', '_', $name)), - 'camelCase' => camel_case(str_replace('-', '_', $name)), - 'StudlyCase' => studly_case(str_replace('-', '_', $name)), + 'snake_case' => Str::snake(str_replace('-', '_', $name)), + 'camelCase' => Str::camel(str_replace('-', '_', $name)), + 'StudlyCase' => Str::studly(str_replace('-', '_', $name)), 'MIGRATION_DATE_TIME' => $this->migrationDateTimeString(), ]; @@ -803,8 +805,8 @@ public function readComposerHooks($file = null) $composer = json_decode($this->filesystem->get($file), true); } - foreach (array_get($composer, 'packages', []) as $package) { - if (array_get($package, 'notification-url') == static::$remote.'/downloads') { + foreach (Arr::get($composer, 'packages', []) as $package) { + if (Arr::get($package, 'notification-url') == static::$remote.'/downloads') { $hooks[$package['name']] = new Hook($package); } } @@ -815,7 +817,7 @@ public function readComposerHooks($file = null) public function readLocalHooks() { $hooks = []; - $directories = array_except($this->filesystem->directories(base_path('hooks')), ['.', '..']); + $directories = Arr::except($this->filesystem->directories(base_path('hooks')), ['.', '..']); foreach ($directories as $directory) { if (!$this->filesystem->exists($directory.'/composer.json')) { continue; @@ -879,8 +881,8 @@ public function checkForUpdates() $hooks = []; $results = json_decode($output, true); - foreach (array_get($results, 'installed', []) as $package) { - if (isset($this->hooks[array_get($package, 'name')])) { + foreach (Arr::get($results, 'installed', []) as $package) { + if (isset($this->hooks[Arr::get($package, 'name')])) { $outdated[$package['name']] = $package['latest']; $hook = $this->hooks[$package['name']]; $hook->setLatest($package['latest']); diff --git a/src/Migrator.php b/src/Migrator.php index 0957996..e8cd0fb 100644 --- a/src/Migrator.php +++ b/src/Migrator.php @@ -88,7 +88,7 @@ protected function rollbackMigrationsByFiles(array $migrations, $files, array $o $this->runDown( $file, $migration, - array_get($options, 'pretend', false) + Arr::get($options, 'pretend', false) ); }