-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6174709
commit d410a81
Showing
13 changed files
with
64 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ponseTransformer/GetRequestedIncludes.php → src/Macros/Response/GetRequestedIncludes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...os/ResponseTransformer/GetTransformer.php → src/Macros/Response/GetTransformer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/Providers/MacroProviders/ResponseMacroServiceProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace Apiato\Core\Providers\MacroProviders; | ||
|
||
use Apiato\Core\Macros\Response\GetRequestedIncludes; | ||
use Apiato\Core\Services\Response; | ||
use Apiato\Core\Macros\Response\Accepted; | ||
use Apiato\Core\Macros\Response\Created; | ||
use Apiato\Core\Macros\Response\CreateFrom; | ||
use Apiato\Core\Macros\Response\GetTransformer; | ||
use Apiato\Core\Macros\Response\NoContent; | ||
use Apiato\Core\Macros\Response\Ok; | ||
use Apiato\Core\Abstracts\Providers\MainServiceProvider as AbstractMainServiceProvider; | ||
use Illuminate\Support\Collection; | ||
|
||
final class ResponseMacroServiceProvider extends AbstractMainServiceProvider { | ||
public function boot(): void | ||
{ | ||
parent::boot(); | ||
|
||
Collection::make($this->macros()) | ||
->reject(static fn ($class, $macro) => Response::hasMacro($macro)) | ||
->each(static fn ($class, $macro) => Response::macro($macro, app($class)())); | ||
} | ||
|
||
private function macros(): array | ||
{ | ||
return [ | ||
'ok' => Ok::class, | ||
'created' => Created::class, | ||
'noContent' => NoContent::class, | ||
'accepted' => Accepted::class, | ||
'createFrom' => CreateFrom::class, | ||
'getTransformer' => GetTransformer::class, | ||
'getRequestedIncludes' => GetRequestedIncludes::class, | ||
]; | ||
} | ||
} |
38 changes: 0 additions & 38 deletions
38
src/Providers/MacroProviders/ResponseTransformerMacroServiceProvider.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters