8000 Added a few @throws in the doc comments. by bweston92 · Pull Request #40 · dingo/api · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added a few @throws in the doc comments. #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Auth/BasicProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function __construct(AuthManager $auth, $identifier = 'email')
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Routing\Route $route
* @return int
* @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
*/
public function authenticate(Request $request, Route $route)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Auth/DingoOAuth2Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public function __construct(Resource $resource)
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Routing\Route $route
* @return int
* @throws \Exception when header authorization fails.
* @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException when invalid token exception is called inside token validator.
*/
public function authenticate(Request $request, Route $route)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Auth/LeagueOAuth2Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public function __construct(Resource $resource, $httpHeadersOnly = false)
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Routing\Route $route
* @return int
* @throws \Exception
* @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
*/
public function authenticate(Request $request, Route $route)
{
Expand Down
1 change: 1 addition & 0 deletions src/Auth/Shield.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function __construct(AuthManager $auth, Container $container, array $prov
* Authenticate the current request.
*
* @return null|\Dingo\Api\Http\Response
* @throws \Exception
*/
public function authenticate(Request $request, Route $route)
{
Expand Down
85 changes: 85 additions & 0 deletions src/Pagination/IlluminatePaginatorWrapper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php namespace Dingo\Api\Pagination;

use Illuminate\Pagination\Paginator;
use League\Fractal\Pagination\PaginatorInterface;

class IlluminatePaginatorWrapper implements PaginatorInterface
{

/**
* @var \Illuminate\Pagination\Paginator
*/
protected $paginator;

/**
* @param \Illuminate\Pagination\Paginator $paginator
*/
public function __construct(Paginator $paginator)
{
$this->paginator = $paginator;
}

/**
* {@inheritDoc}
*/
public function getCurrentPage()
{
return $this->paginator->getCurrentPage();
}

/**
* {@inheritDoc}
*/
public function getLastPage()
{
return $this->paginator->getLastPage();
}

/**
* {@inheritDoc}
*/
public function getTotal()
{
return $this->paginator->getTotal();
}

/**
* {@inheritDoc}
*/
public function count()
{
return $this->paginator->count();
}

/**
* {@inheritDoc}
*/
public function getPerPage()
{
return $this->paginator->getPerPage();
}

/**
* {@inheritDoc}
*/
public function getUrl($page)
{
return $this->paginator->getUrl($page);
}

/**
* @param string $method
* @param array $args
* @throws \BadMethodCallException
*/
public function __call($method, $args)
{
if (! method_exists($this->paginator, $method))
{
throw new \BadMethodCallException("Unable to find method {$method} on paginator instance.");
}

return call_user_func_array([$this->paginator, $method], $args);
}

}
2 changes: 2 additions & 0 deletions src/Routing/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class Router extends IlluminateRouter {
* @param array $options
* @param callable $callback
* @return void
* @throws \BadMethodCallException when api version not specified.
*/
public function api($options, callable $callback)
{
Expand Down Expand Up @@ -136,6 +137,7 @@ public function api($options, callable $callback)
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response|\Dingo\Api\Http\Response
* @throws \HttpExceptionInterface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the full Symfony namespace reference here.

*/
public function dispatch(Request $request)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Transformer/FractalTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use League\Fractal\Manager as Fractal;
use League\Fractal\Resource\Item as FractalItem;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use Dingo\Api\Pagination\IlluminatePaginatorWrapper;
use Illuminate\Support\Collection as IlluminateCollection;
use Illuminate\Pagination\Paginator as IlluminatePaginator;
use League\Fractal\Resource\Collection as FractalCollection;
Expand Down Expand Up @@ -63,7 +63,7 @@ public function transformResponse($response, $transformer)
// collection resource.
if ($response instanceof IlluminatePaginator)
{
$paginator = new IlluminatePaginatorAdapter($response);
$paginator = new IlluminatePaginatorWrapper($response);

$resource->setPaginator($paginator);
}
Expand Down
0