Completed
Push — master ( 8696cf...c1ad79 )
by Julien
03:04
created

src/OAuth2/Silex/OAuth2JsonControllerProvider.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Eole\Sandstone\OAuth2\Silex;
4
5
use Symfony\Component\HttpFoundation\Request;
6
use Symfony\Component\HttpFoundation\JsonResponse;
7
use Symfony\Component\HttpKernel\Exception\HttpException;
8
use Silex\Api\ControllerProviderInterface;
9
use Silex\Application;
10
11
class OAuth2JsonControllerProvider implements ControllerProviderInterface
12
{
13
    /**
14
     * {@inheritDoc}
15
     */
16
    public function connect(Application $app)
17
    {
18
        $controllers = $app['controllers_factory'];
19
20
        $controllers->post('/access-token', function (Request $request) use ($app) {
21
            try {
22
                $token = $app['sandstone.oauth.controller']->postAccessToken($request);
23
24
                return new JsonResponse($token);
25
            } catch (OAuthException $e) {
0 ignored issues
show
The class Eole\Sandstone\OAuth2\Silex\OAuthException does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
26
                throw new HttpException($e->httpStatusCode, $e->errorType.': '.$e->getMessage(), $e);
27
            }
28
        });
29
30
        return $controllers;
31
    }
32
}
33