Skip to content

Commit

Permalink
Make use of HelperClass
Browse files Browse the repository at this point in the history
  • Loading branch information
ajthinking committed Mar 9, 2022
1 parent 12e8840 commit bf07970
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
7 changes: 3 additions & 4 deletions src/Endpoints/Laravel/BelongsTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions src/Endpoints/Laravel/BelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions src/Endpoints/Laravel/HasMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
7 changes: 3 additions & 4 deletions src/Endpoints/Laravel/HasOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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()
Expand Down

0 comments on commit bf07970

Please sign in to comment.