diff --git a/src/Endpoints/Laravel/BelongsTo.php b/src/Endpoints/Laravel/BelongsTo.php index 5edc364..1f0e811 100644 --- a/src/Endpoints/Laravel/BelongsTo.php +++ b/src/Endpoints/Laravel/BelongsTo.php @@ -3,10 +3,9 @@ namespace Archetype\Endpoints\Laravel; use Archetype\Endpoints\EndpointProvider; +use Archetype\Support\LaravelStrings; use Archetype\Support\Snippet; -use Illuminate\Support\Str; use Illuminate\Support\Arr; -use PhpParser\BuilderFactory; class BelongsTo extends EndpointProvider { @@ -26,9 +25,9 @@ protected function add($targets) ->insertStmts( collect(Arr::wrap($targets))->map(function ($target) { return Snippet::___BELONGS_TO_METHOD___([ - '___BELONGS_TO_METHOD___' => Str::belongsToMethodName($target), + '___BELONGS_TO_METHOD___' => LaravelStrings::belongsToMethodName($target), '___TARGET_CLASS___' => class_basename($target), - '___TARGET_IN_DOC_BLOCK___' => Str::belongsToDocBlockName($target) + '___TARGET_IN_DOC_BLOCK___' => LaravelStrings::belongsToDocBlockName($target) ]); })->toArray() )->commit() diff --git a/src/Endpoints/Laravel/BelongsToMany.php b/src/Endpoints/Laravel/BelongsToMany.php index 55f1264..a1f9e57 100644 --- a/src/Endpoints/Laravel/BelongsToMany.php +++ b/src/Endpoints/Laravel/BelongsToMany.php @@ -3,8 +3,8 @@ namespace Archetype\Endpoints\Laravel; use Archetype\Endpoints\EndpointProvider; +use Archetype\Support\LaravelStrings; use Archetype\Support\Snippet; -use Illuminate\Support\Str; use Illuminate\Support\Arr; class BelongsToMany extends EndpointProvider @@ -25,9 +25,9 @@ protected function add($targets) ->insertStmts( collect(Arr::wrap($targets))->map(function ($target) { return Snippet::___BELONGS_TO_MANY_METHOD___([ - '___BELONGS_TO_MANY_METHOD___' => Str::belongsToManyMethodName($target), + '___BELONGS_TO_MANY_METHOD___' => LaravelStrings::belongsToManyMethodName($target), '___TARGET_CLASS___' => class_basename($target), - '___TARGET_IN_DOC_BLOCK___' => Str::belongsToManyDocBlockName($target) + '___TARGET_IN_DOC_BLOCK___' => LaravelStrings::belongsToManyDocBlockName($target) ]); })->toArray() )->commit() diff --git a/src/Endpoints/Laravel/HasMany.php b/src/Endpoints/Laravel/HasMany.php index 0b51b30..30791bd 100644 --- a/src/Endpoints/Laravel/HasMany.php +++ b/src/Endpoints/Laravel/HasMany.php @@ -3,8 +3,8 @@ namespace Archetype\Endpoints\Laravel; use Archetype\Endpoints\EndpointProvider; +use Archetype\Support\LaravelStrings; use Archetype\Support\Snippet; -use Illuminate\Support\Str; use Illuminate\Support\Arr; class HasMany extends EndpointProvider @@ -25,9 +25,9 @@ protected function add($targets) ->insertStmts( collect(Arr::wrap($targets))->map(function ($target) { return Snippet::___HAS_MANY_METHOD___([ - '___HAS_MANY_METHOD___' => Str::hasManyMethodName($target), + '___HAS_MANY_METHOD___' => LaravelStrings::hasManyMethodName($target), '___TARGET_CLASS___' => class_basename($target), - '___TARGET_IN_DOC_BLOCK___' => Str::hasManyDocBlockName($target) + '___TARGET_IN_DOC_BLOCK___' => LaravelStrings::hasManyDocBlockName($target) ]); })->toArray() )->commit() diff --git a/src/Endpoints/Laravel/HasOne.php b/src/Endpoints/Laravel/HasOne.php index 93ae874..cab6576 100644 --- a/src/Endpoints/Laravel/HasOne.php +++ b/src/Endpoints/Laravel/HasOne.php @@ -3,9 +3,8 @@ namespace Archetype\Endpoints\Laravel; use Archetype\Endpoints\EndpointProvider; +use Archetype\Support\LaravelStrings; use Archetype\Support\Snippet; -use Illuminate\Support\Str; -use Illuminate\Support\Arr; class HasOne extends EndpointProvider { @@ -25,9 +24,9 @@ protected function add($targets) ->insertStmts( collect($targets)->map(function ($target) { return Snippet::___HAS_ONE_METHOD___([ - '___HAS_ONE_METHOD___' => Str::hasOneMethodName($target), + '___HAS_ONE_METHOD___' => LaravelStrings::hasOneMethodName($target), '___TARGET_CLASS___' => class_basename($target), - '___TARGET_IN_DOC_BLOCK___' => Str::hasOneDocBlockName($target) + '___TARGET_IN_DOC_BLOCK___' => LaravelStrings::hasOneDocBlockName($target) ]); })->toArray() )->commit() diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 83b3e65..0e06be6 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -7,12 +7,9 @@ use Archetype\Commands\ErrorsCommand; use Archetype\Factories\LaravelFileFactory; use Archetype\Factories\PHPFileFactory; -use Archetype\Traits\AddsLaravelStringsToStrWithMacros; class ServiceProvider extends BaseServiceProvider { - use AddsLaravelStringsToStrWithMacros; - public function register() { $this->registerFacades(); @@ -22,7 +19,6 @@ public function register() public function boot() { - $this->bootStrMacros(); $this->publishConfig(); } diff --git a/src/Support/LaravelStrings.php b/src/Support/LaravelStrings.php new file mode 100644 index 0000000..3f46eab --- /dev/null +++ b/src/Support/LaravelStrings.php @@ -0,0 +1,72 @@ +