8000 Apply fixes from StyleCI · Lucky-Loek/Symfony-API-Example@db05ae7 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 17, 2019. It is now read-only.

Commit db05ae7

Browse files
Loek van der LindeStyleCIBot
Loek van der Linde
authored andcommitted
Apply fixes from StyleCI
1 parent ceba31c commit db05ae7

File tree

8 files changed

+40
-35
lines changed

8 files changed

+40
-35
lines changed

src/AppBundle/Controller/CarController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
1414

1515
/**
16-
* Class CarController
17-
* @package AppBundle\Controller
16+
* Class CarController.
17+
*
1818
* @Security("is_granted('ROLE_USER')")
1919
*/
2020
class CarController extends FOSRestController

src/AppBundle/Controller/TokenController.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
99
use Symfony\Component\HttpFoundation\JsonResponse;
1010
use Symfony\Component\HttpFoundation\Request;
11-
use Symfony\Component\HttpFoundation\Response;
12-
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
1311

1412
class TokenController extends Controller
1513
{
@@ -42,7 +40,7 @@ public function newTokenAction(Request $request)
4240
// Later we can decode the token and easily search for a matching user because we have the username
4341
// No need for storing tokens in the DB anymore! :)
4442
'username' => $user->getUsername(),
45-
'exp' => time() + 600
43+
'exp' => time() + 600,
4644
]);
4745

4846
return new JsonResponse(['token' => $token]);

src/AppBundle/DataFixtures/ORM/LoadUserData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class LoadUserData implements FixtureInterface, ContainerAwareInterface
1616
protected $container;
1717

1818
/**
19-
* Load data fixtures with the passed EntityManager
19+
* Load data fixtures with the passed EntityManager.
2020
*
2121
* @param ObjectManager $manager
2222
*/

src/AppBundle/Entity/User.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Symfony\Component\Security\Core\User\UserInterface;
88

99
/**
10-
* User
10+
* User.
1111
*
1212
* @ORM\Table(name="user")
1313
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
@@ -37,9 +37,8 @@ class User implements UserInterface, Serializable
3737
*/
3838
private $password;
3939

40-
4140
/**
42-
* Get id
41+
* Get id.
4342
*
4443
* @return int
4544
*/
@@ -49,7 +48,7 @@ public function getId()
4948
}
5049

5150
/**
52-
* Set username
51+
* Set username.
5352
*
5453
* @param string $username
5554
*
@@ -63,7 +62,7 @@ public function setUsername($username)
6362
}
6463

6564
/**
66-
* Get username
65+
* Get username.
6766
*
6867
* @return string
6968
*/
@@ -73,7 +72,7 @@ public function getUsername()
7372
}
7473

7574
/**
76-
* Set password
75+
* Set password.
7776
*
7877
* @param string $password
7978
*
@@ -87,7 +86,7 @@ public function setPassword($password)
8786
}
8887

8988
/**
90-
* Get password
89+
* Get password.
9190
*
9291
* @return string
9392
*/
@@ -140,32 +139,37 @@ public function eraseCredentials()
140139
}
141140

142141
/**
143-
* String representation of object
144-
* @link http://php.net/manual/en/serializable.serialize.php
142+
* String representation of object.
143+
*
144+
* @see http://php.net/manual/en/serializable.serialize.php
145+
*
145146
* @return string the string representation of the object or null
147+
*
146148
* @since 5.1.0
147149
*/
148150
public function serialize()
149151
{
150152
return serialize([
151153
$this->id,
152154
$this->username,
153-
$this->password
155+
$this->password,
154156
]);
155157
}
156158

157159
/**
158-
* Constructs the object
159-
* @link http://php.net/manual/en/serializable.unserialize.php
160+
* Constructs the object.
161+
*
162+
* @see http://php.net/manual/en/serializable.unserialize.php
163+
*
160164
* @param string $serialized <p>
161165
* The string representation of the object.
162166
* </p>
163-
* @return void
167+
*
164168
* @since 5.1.0
165169
*/
166170
public function unserialize($serialized)
167171
{
168-
list (
172+
list(
169173
$this->id,
170174
$this->username,
171175
$this->password

src/AppBundle/Repository/UserRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace AppBundle\Repository;
44

55
/**
6-
* UserRepository
6+
* UserRepository.
77
*
88
* This class was generated by the Doctrine ORM. Add your own custom
99
* repository methods below.

src/AppBundle/Security/JwtTokenAuthenticator.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ public function __construct(JWTEncoderInterface $encoder, EntityManager $em)
4646
* B) For an API token authentication system, you return a 401 response
4747
* return new Response('Auth header required', 401);
4848
*
49-
* @param Request $request The request that resulted in an AuthenticationException
49+
* @param Request $request The request that resulted in an AuthenticationException
5050
* @param AuthenticationException $authException The exception that started the authentication process
5151
*
5252
* @return Response
5353
*/
5454
public function start(Request $request, AuthenticationException $authException = null)
5555
{
5656
return new JsonResponse([
57-
'error' => 'Auth required'
57+
'error' => 'Auth required',
5858
], 401);
5959
}
6060

@@ -108,7 +108,7 @@ public function getCredentials(Request $request)
108108
* You may throw an AuthenticationException if you wish. If you return
109109
* null, then a UsernameNotFoundException is thrown for you.
110110
*
111-
* @param mixed $credentials
111+
* @param mixed $credentials
112112
* @param UserProviderInterface $userProvider
113113
*
114114
* @throws AuthenticationException
@@ -139,7 +139,7 @@ public function getUser($credentials, UserProviderInterface $userProvider)
139139
*
140140
* The *credentials* are the return value from getCredentials()
141141
*
142-
* @param mixed $credentials
142+
* @param mixed $credentials
143143
* @param UserInterface $user
144144
*
145145
* @return bool
@@ -161,7 +161,7 @@ public function checkCredentials($credentials, UserInterface $user)
161161
* If you return null, the request will continue, but the user will
162162
* not be authenticated. This is probably not what you want to do.
163163
*
164-
* @param Request $request
164+
* @param Request $request
165165
* @param AuthenticationException $exception
166166
*
167167
* @return Response|null
@@ -180,9 +180,9 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio
180180
* If you return null, the current request will continue, and the user
181181
* will be authenticated. This makes sense, for example, with an API.
182182
*
183-
* @param Request $request
183+
* @param Request $request
184184
* @param TokenInterface $token
185-
* @param string $providerKey The provider (i.e. firewall) key
185+
* @param string $providerKey The provider (i.e. firewall) key
186186
*
187187
* @return Response|null
188188
*/

tests/AppBundle/Controller/CarControllerTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,18 @@ class CarControllerTest extends \PHPUnit_Framework_TestCase
1212
*/
1313
protected $client;
1414

15-
public function setUp() {
15+
public function setUp()
16+
{
1617
$this->client = new Client([
17-
'base_uri' => 'http://symfony.app'
18+
'base_uri' => 'http://symfony.app',
1819
]);
1920
}
2021

2122
/**
2223
* @test
2324
*/
24-
public function shouldThrow401OnUnauthorizedUserRequest() {
25+
public function shouldThrow401OnUnauthorizedUserRequest()
26+
{
2527
$this->expectException(ClientException::class);
2628
$this->client->request('GET', 'car');
2729
}

tests/AppBundle/Controller/TokenControllerTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ class TokenControllerTest extends \PHPUnit_Framework_TestCase
1313
*/
1414
protected $client;
1515

16-
public function setUp() {
16+
public function setUp()
17+
{
1718
$this->client = new Client([
18-
'base_uri' => 'http://symfony.app'
19+
'base_uri' => 'http://symfony.app',
1920
]);
2021
}
2122

@@ -29,7 +30,7 @@ public function shouldCreateTokenOnValidCredentials()
2930
'/api/token',
3031
[
3132
'username' => 'admin',
32-
'password' => 'unsafepassword'
33+
'password' => 'unsafepassword',
3334
]
3435
);
3536

@@ -54,7 +55,7 @@ public function shouldThrowExceptionOnInvalidCredentials()
5455
'/api/token',
5556
[
5657
'username' => 'admin',
57-
'password' => 'reallysafepassword'
58+
'password' => 'reallysafepassword',
5859
]
5960
);
6061

0 commit comments

Comments
 (0)
0