Skip to content

Commit

Permalink
[2.x] Minor function order [skip-ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkGhostHunter committed Mar 14, 2024
1 parent 66c0066 commit bd2784b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protected $actions = [

For example, to update a chirp, we could call `edit` directly from our `ChirpApi`.

While you're at it, add the PHPDoc manually to your API Server to take advantage of autocompletion (intellisense). Just remember that you can access responses as property if these don't require data/parameters, and to take out the first parameter as the path.
While you're at it, add the PHPDoc manually to your API Server to take advantage of autocompletion (intellisense).

```php
use Laragear\ApiManager\ApiServer;
Expand Down
20 changes: 10 additions & 10 deletions src/ApiRequestProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,16 @@ protected function wrapResponse(mixed $response, string $name): mixed
return $response;
}

/**
* Retrieves the class Response for this action.
*
* @return class-string<\Illuminate\Http\Client\Response>|null
*/
protected function findClassResponse(string $action): ?string
{
return Arr::get($this->api->responses, Str::camel($action));
}

/**
* Proxy accessing an attribute onto the API instance.
*/
Expand All @@ -201,16 +211,6 @@ public function __get(string $name): mixed
throw new ErrorException(sprintf('Undefined property: %s::$%s', $this->api::class, $name));
}

/**
* Retrieves the class Response for this action.
*
* @return class-string<\Illuminate\Http\Client\Response>|null
*/
protected function findClassResponse(string $action): ?string
{
return Arr::get($this->api->responses, Str::camel($action));
}

/**
* Handle dynamic calls to the object.
*
Expand Down

0 comments on commit bd2784b

Please sign in to comment.