Skip to content

Commit 62c1993

Browse files
committed
Merge pull request #381 from FriendsOfSymfony/CS
Fix CS
2 parents 0353b9a + 336fdeb commit 62c1993

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+300
-139
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ vendor/
44
Propel/om/
55
Propel/map/
66
composer.lock
7+
.php_cs.cache

.php_cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the FOSOAuthServerBundle package.
5+
*
6+
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
use Symfony\CS\Config\Config;
13+
use Symfony\CS\Finder\DefaultFinder;
14+
use Symfony\CS\Fixer\Contrib\HeaderCommentFixer;
15+
use Symfony\CS\FixerInterface;
16+
17+
$finder = DefaultFinder::create()
18+
->in(__DIR__)
19+
;
20+
21+
$header = <<<EOF
22+
This file is part of the FOSOAuthServerBundle package.
23+
24+
(c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
25+
26+
For the full copyright and license information, please view the LICENSE
27+
file that was distributed with this source code.
28+
EOF;
29+
30+
HeaderCommentFixer::setHeader($header);
31+
32+
return Config::create()
33+
->level(FixerInterface::SYMFONY_LEVEL)
34+
->fixers(array('align_double_arrow', 'header_comment'))
35+
->finder($finder)
36+
->setUsingCache(true)
37+
;

Command/CleanCommand.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/*
34
* This file is part of the FOSOAuthServerBundle package.
45
*
@@ -40,9 +41,9 @@ protected function configure()
4041
protected function execute(InputInterface $input, OutputInterface $output)
4142
{
4243
$services = array(
43-
'fos_oauth_server.access_token_manager' => 'Access token',
44-
'fos_oauth_server.refresh_token_manager' => 'Refresh token',
45-
'fos_oauth_server.auth_code_manager' => 'Auth code',
44+
'fos_oauth_server.access_token_manager' => 'Access token',
45+
'fos_oauth_server.refresh_token_manager' => 'Refresh token',
46+
'fos_oauth_server.auth_code_manager' => 'Auth code',
4647
);
4748

4849
foreach ($services as $service => $name) {

Controller/AuthorizeController.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,21 @@
1717
use OAuth2\OAuth2ServerException;
1818
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
1919
use Symfony\Component\DependencyInjection\ContainerInterface;
20-
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
2120
use Symfony\Component\HttpFoundation\Request;
2221
use Symfony\Component\HttpFoundation\Response;
2322
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
2423
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
2524
use Symfony\Component\Security\Core\User\UserInterface;
2625

2726
/**
28-
* Controller handling basic authorization
27+
* Controller handling basic authorization.
2928
*
3029
* @author Chris Jones <[email protected]>
3130
*/
3231
class AuthorizeController implements ContainerAwareInterface
3332
{
3433
/**
35-
* @var \FOS\OAuthServerBundle\Model\ClientInterface
34+
* @var ClientInterface
3635
*/
3736
private $client;
3837

@@ -52,7 +51,7 @@ public function setContainer(ContainerInterface $container = null)
5251
}
5352

5453
/**
55-
* Authorize
54+
* Authorize.
5655
*/
5756
public function authorizeAction(Request $request)
5857
{
@@ -88,18 +87,18 @@ public function authorizeAction(Request $request)
8887
}
8988

9089
return $this->container->get('templating')->renderResponse(
91-
'FOSOAuthServerBundle:Authorize:authorize.html.' . $this->container->getParameter('fos_oauth_server.template.engine'),
90+
'FOSOAuthServerBundle:Authorize:authorize.html.'.$this->container->getParameter('fos_oauth_server.template.engine'),
9291
array(
93-
'form' => $form->createView(),
94-
'client' => $this->getClient(),
92+
'form' => $form->createView(),
93+
'client' => $this->getClient(),
9594
)
9695
);
9796
}
9897

9998
/**
10099
* @param UserInterface $user
101100
* @param AuthorizeFormHandler $formHandler
102-
* @param Request $request
101+
* @param Request $request
103102
*
104103
* @return Response
105104
*/
@@ -130,9 +129,10 @@ protected function processSuccess(UserInterface $user, AuthorizeFormHandler $for
130129
}
131130

132131
/**
133-
* Generate the redirection url when the authorize is completed
132+
* Generate the redirection url when the authorize is completed.
133+
*
134+
* @param UserInterface $user
134135
*
135-
* @param \FOS\OAuthServerBundle\Model\UserInterface $user
136136
* @return string
137137
*/
138138
protected function getRedirectionUrl(UserInterface $user)
@@ -141,7 +141,7 @@ protected function getRedirectionUrl(UserInterface $user)
141141
}
142142

143143
/**
144-
* @return ClientInterface
144+
* @return ClientInterface.
145145
*/
146146
protected function getClient()
147147
{
@@ -170,10 +170,11 @@ protected function getClient()
170170
return $this->client;
171171
}
172172

173-
private function getCurrentRequest() {
174-
if($this->container->has('request_stack')) {
173+
private function getCurrentRequest()
174+
{
175+
if ($this->container->has('request_stack')) {
175176
$request = $this->container->get('request_stack')->getCurrentRequest();
176-
if(null === $request) {
177+
if (null === $request) {
177178
throw new \RuntimeException('No current request.');
178179
}
179180

@@ -185,7 +186,7 @@ private function getCurrentRequest() {
185186

186187
private function getTokenStorage()
187188
{
188-
if($this->container->has('security.token_storage')) {
189+
if ($this->container->has('security.token_storage')) {
189190
return $this->container->get('security.token_storage');
190191
}
191192

Controller/TokenController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public function __construct(OAuth2 $server)
3232
}
3333

3434
/**
35-
* @param Request $request
35+
* @param Request $request
36+
*
3637
* @return Response
3738
*/
3839
public function tokenAction(Request $request)

DependencyInjection/Compiler/GrantExtensionsCompilerPass.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the FOSOAuthServerBundle package.
5+
*
6+
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace FOS\OAuthServerBundle\DependencyInjection\Compiler;
413

514
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

DependencyInjection/Compiler/RequestStackCompilerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class RequestStackCompilerPass implements CompilerPassInterface
2727
*/
2828
public function process(ContainerBuilder $container)
2929
{
30-
if($container->has('request_stack')) {
30+
if ($container->has('request_stack')) {
3131
return;
3232
}
3333

DependencyInjection/Configuration.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
use Symfony\Component\Config\Definition\ConfigurationInterface;
1717

1818
/**
19-
* This is the class that validates and merges configuration from your app/config files
19+
* This is the class that validates and merges configuration from your app/config files.
2020
*
2121
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
2222
*/
2323
class Configuration implements ConfigurationInterface
2424
{
2525
/**
26-
* {@inheritDoc}
26+
* {@inheritdoc}
2727
*/
2828
public function getConfigTreeBuilder()
2929
{
@@ -37,7 +37,7 @@ public function getConfigTreeBuilder()
3737
->scalarNode('db_driver')
3838
->validate()
3939
->ifNotInArray($supportedDrivers)
40-
->thenInvalid('The driver %s is not supported. Please choose one of ' . json_encode($supportedDrivers))
40+
->thenInvalid('The driver %s is not supported. Please choose one of '.json_encode($supportedDrivers))
4141
->end()
4242
->isRequired()
4343
->cannotBeEmpty()

DependencyInjection/FOSOAuthServerExtension.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
class FOSOAuthServerExtension extends Extension
2323
{
2424
/**
25-
* {@inheritDoc}
25+
* {@inheritdoc}
2626
*/
2727
public function load(array $configs, ContainerBuilder $container)
2828
{
29-
$processor = new Processor();
29+
$processor = new Processor();
3030
$configuration = new Configuration();
3131

3232
$config = $processor->processConfiguration($configuration, $configs);
@@ -52,11 +52,11 @@ public function load(array $configs, ContainerBuilder $container)
5252

5353
$this->remapParametersNamespaces($config, $container, array(
5454
'' => array(
55-
'model_manager_name' => 'fos_oauth_server.model_manager_name',
56-
'client_class' => 'fos_oauth_server.model.client.class',
57-
'access_token_class' => 'fos_oauth_server.model.access_token.class',
58-
'refresh_token_class' => 'fos_oauth_server.model.refresh_token.class',
59-
'auth_code_class' => 'fos_oauth_server.model.auth_code.class',
55+
'model_manager_name' => 'fos_oauth_server.model_manager_name',
56+
'client_class' => 'fos_oauth_server.model.client.class',
57+
'access_token_class' => 'fos_oauth_server.model.access_token.class',
58+
'refresh_token_class' => 'fos_oauth_server.model.refresh_token.class',
59+
'auth_code_class' => 'fos_oauth_server.model.auth_code.class',
6060
),
6161
'template' => 'fos_oauth_server.template.%s',
6262
));

Document/AuthCodeManager.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,19 @@
1212
namespace FOS\OAuthServerBundle\Document;
1313

1414
use Doctrine\ODM\MongoDB\DocumentManager;
15+
use Doctrine\ODM\MongoDB\DocumentRepository;
1516
use FOS\OAuthServerBundle\Model\AuthCodeInterface;
1617
use FOS\OAuthServerBundle\Model\AuthCodeManager as BaseAuthCodeManager;
1718

1819
class AuthCodeManager extends BaseAuthCodeManager
1920
{
2021
/**
21-
* @var \Doctrine\ODM\MongoDB\DocumentManager
22+
* @var DocumentManager
2223
*/
2324
protected $dm;
2425

2526
/**
26-
* @var \Doctrine\ODM\MongoDB\DocumentRepository
27+
* @var DocumentRepository
2728
*/
2829
protected $repository;
2930

0 commit comments

Comments
 (0)