Skip to content

Commit 506c9de

Browse files
committed
Fixed code style
1 parent 57d9e60 commit 506c9de

Some content is hidden

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

49 files changed

+433
-527
lines changed

Controller/Annotations/Param.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ abstract class Param
2929
public $default = null;
3030
/** @var string */
3131
public $description;
32-
/** @var boolean */
32+
/** @var bool */
3333
public $strict = false;
34-
/** @var boolean */
34+
/** @var bool */
3535
public $array = false;
36-
/** @var boolean */
36+
/** @var bool */
3737
public $nullable = false;
3838

3939
/**

Controller/Annotations/RequestParam.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
*/
2222
class RequestParam extends Param
2323
{
24-
/** @var boolean */
24+
/** @var bool */
2525
public $strict = true;
2626
}

Controller/Annotations/View.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class View extends Template
3636
protected $serializerGroups;
3737

3838
/**
39-
* @var Boolean
39+
* @var bool
4040
*/
4141
protected $populateDefaultVars = true;
4242

@@ -109,15 +109,15 @@ public function getSerializerGroups()
109109
}
110110

111111
/**
112-
* @param Boolean $populateDefaultVars
112+
* @param bool $populateDefaultVars
113113
*/
114114
public function setPopulateDefaultVars($populateDefaultVars)
115115
{
116-
$this->populateDefaultVars = (Boolean) $populateDefaultVars;
116+
$this->populateDefaultVars = (bool) $populateDefaultVars;
117117
}
118118

119119
/**
120-
* @return Boolean
120+
* @return bool
121121
*/
122122
public function isPopulateDefaultVars()
123123
{

Controller/ExceptionController.php

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
2020
use Symfony\Component\HttpFoundation\Request;
2121
use Symfony\Component\HttpFoundation\Response;
22-
2322
use FOS\RestBundle\Util\Codes;
2423
use FOS\RestBundle\View\ViewHandler;
2524
use FOS\RestBundle\View\View;
@@ -42,18 +41,21 @@ protected function createExceptionWrapper(array $parameters)
4241
{
4342
/** @var ExceptionWrapperHandlerInterface $exceptionWrapperHandler */
4443
$exceptionWrapperHandler = $this->container->get('fos_rest.view.exception_wrapper_handler');
44+
4545
return $exceptionWrapperHandler->wrap($parameters);
4646
}
4747

4848
/**
4949
* Converts an Exception to a Response.
5050
*
51-
* @param Request $request Request
52-
* @param HttpFlattenException|DebugFlattenException $exception A HttpFlattenException|DebugFlattenException instance
53-
* @param DebugLoggerInterface $logger A DebugLoggerInterface instance
54-
* @param string $format The format to use for rendering (html, xml, ...)
51+
* @param Request $request
52+
* @param HttpFlattenException|DebugFlattenException $exception
53+
* @param DebugLoggerInterface $logger
54+
* @param string $format
5555
*
56-
* @return Response Response instance
56+
* @return Response
57+
*
58+
* @throws \InvalidArgumentException
5759
*/
5860
public function showAction(Request $request, $exception, DebugLoggerInterface $logger = null, $format = 'html')
5961
{
@@ -109,7 +111,7 @@ public function showAction(Request $request, $exception, DebugLoggerInterface $l
109111
}
110112

111113
/**
112-
* Get and clean any content that was already outputted
114+
* Gets and cleans any content that was already outputted.
113115
*
114116
* This code comes from Symfony and should be synchronized on a regular basis
115117
* see src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php
@@ -134,12 +136,12 @@ protected function getAndCleanOutputBuffering()
134136
}
135137

136138
/**
137-
* Extract the exception message
139+
* Extracts the exception message.
138140
*
139-
* @param HttpFlattenException|DebugFlattenException $exception A HttpFlattenException|DebugFlattenException instance
141+
* @param HttpFlattenException|DebugFlattenException $exception
140142
* @param array $exceptionMap
141143
*
142-
* @return string Message
144+
* @return int|false
143145
*/
144146
protected function isSubclassOf($exception, $exceptionMap)
145147
{
@@ -162,9 +164,9 @@ protected function isSubclassOf($exception, $exceptionMap)
162164
}
163165

164166
/**
165-
* Extract the exception message
167+
* Extracts the exception message.
166168
*
167-
* @param HttpFlattenException|DebugFlattenException $exception A HttpFlattenException|DebugFlattenException instance
169+
* @param HttpFlattenException|DebugFlattenException $exception
168170
*
169171
* @return string Message
170172
*/
@@ -183,27 +185,27 @@ protected function getExceptionMessage($exception)
183185
}
184186

185187
/**
186-
* Determine the status code to use for the response
188+
* Determines the status code to use for the response.
187189
*
188-
* @param HttpFlattenException|DebugFlattenException $exception A HttpFlattenException|DebugFlattenException instance
190+
* @param HttpFlattenException|DebugFlattenException $exception
189191
*
190-
* @return integer An HTTP response code
192+
* @return int
191193
*/
192194
protected function getStatusCode($exception)
193195
{
194196
$exceptionMap = $this->container->getParameter('fos_rest.exception.codes');
195197
$isExceptionMappedToStatusCode = $this->isSubclassOf($exception, $exceptionMap);
196198

197-
return ($isExceptionMappedToStatusCode) ? $isExceptionMappedToStatusCode : $exception->getStatusCode();
199+
return $isExceptionMappedToStatusCode ?: $exception->getStatusCode();
198200
}
199201

200202
/**
201-
* Determine the format to use for the response
203+
* Determines the format to use for the response.
202204
*
203-
* @param Request $request Request instance
204-
* @param string $format The format to use for rendering (html, xml, ...)
205+
* @param Request $request
206+
* @param string $format
205207
*
206-
* @return string Encoding format
208+
* @return string
207209
*/
208210
protected function getFormat(Request $request, $format)
209211
{
@@ -215,19 +217,19 @@ protected function getFormat(Request $request, $format)
215217
}
216218

217219
/**
218-
* Determine the parameters to pass to the view layer.
220+
* Determines the parameters to pass to the view layer.
219221
*
220222
* Overwrite it in a custom ExceptionController class to add additionally parameters
221223
* that should be passed to the view layer.
222224
*
223-
* @param ViewHandler $viewHandler The view handler instance
224-
* @param string $currentContent The current content in the output buffer
225-
* @param integer $code An HTTP response code
226-
* @param HttpFlattenException|DebugFlattenException $exception A HttpFlattenException|DebugFlattenException instance
227-
* @param DebugLoggerInterface $logger A DebugLoggerInterface instance
228-
* @param string $format The format to use for rendering (html, xml, ...)
225+
* @param ViewHandler $viewHandler
226+
* @param string $currentContent
227+
* @param int $code
228+
* @param HttpFlattenException|DebugFlattenException $exception
229+
* @param DebugLoggerInterface $logger
230+
* @param string $format
229231
*
230-
* @return array Template parameters
232+
* @return array
231233
*/
232234
protected function getParameters(ViewHandler $viewHandler, $currentContent, $code, $exception, DebugLoggerInterface $logger = null, $format = 'html')
233235
{
@@ -248,7 +250,7 @@ protected function getParameters(ViewHandler $viewHandler, $currentContent, $cod
248250
}
249251

250252
/**
251-
* Find the template for the given format and status code
253+
* Finds the template for the given format and status code.
252254
*
253255
* Note this method needs to be overridden in case another
254256
* engine than Twig should be supported;
@@ -258,12 +260,12 @@ protected function getParameters(ViewHandler $viewHandler, $currentContent, $cod
258260
*
259261
* @param Request $request
260262
* @param string $format
261-
* @param integer $code An HTTP response status code
262-
* @param Boolean $debug
263+
* @param int $statusCode
264+
* @param bool $debug
263265
*
264266
* @return TemplateReference
265267
*/
266-
protected function findTemplate(Request $request, $format, $code, $debug)
268+
protected function findTemplate(Request $request, $format, $statusCode, $debug)
267269
{
268270
$name = $debug ? 'exception' : 'error';
269271
if ($debug && 'html' == $format) {
@@ -272,7 +274,7 @@ protected function findTemplate(Request $request, $format, $code, $debug)
272274

273275
// when not in debug, try to find a template for the specific HTTP status code and format
274276
if (!$debug) {
275-
$template = new TemplateReference('TwigBundle', 'Exception', $name.$code, $format, 'twig');
277+
$template = new TemplateReference('TwigBundle', 'Exception', $name.$statusCode, $format, 'twig');
276278
if ($this->container->get('templating')->exists($template)) {
277279
return $template;
278280
}

Controller/FOSRestController.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
1515
use Symfony\Component\HttpFoundation\Response;
16-
1716
use FOS\RestBundle\View\View;
1817
use FOS\RestBundle\View\RedirectView;
1918
use FOS\RestBundle\View\RouteRedirectView;
@@ -27,13 +26,13 @@
2726
abstract class FOSRestController extends Controller
2827
{
2928
/**
30-
* Create a view
29+
* Creates a view.
3130
*
3231
* Convenience method to allow for a fluent interface.
3332
*
34-
* @param mixed $data
35-
* @param integer $statusCode
36-
* @param array $headers
33+
* @param mixed $data
34+
* @param int $statusCode
35+
* @param array $headers
3736
*
3837
* @return View
3938
*/
@@ -43,13 +42,13 @@ protected function view($data = null, $statusCode = null, array $headers = array
4342
}
4443

4544
/**
46-
* Create a Redirect view
45+
* Creates a Redirect view.
4746
*
4847
* Convenience method to allow for a fluent interface.
4948
*
50-
* @param string $url
51-
* @param integer $statusCode
52-
* @param array $headers
49+
* @param string $url
50+
* @param int $statusCode
51+
* @param array $headers
5352
*
5453
* @return View
5554
*/
@@ -59,14 +58,14 @@ protected function redirectView($url, $statusCode = Codes::HTTP_FOUND, array $he
5958
}
6059

6160
/**
62-
* Create a Route Redirect View
61+
* Creates a Route Redirect View.
6362
*
6463
* Convenience method to allow for a fluent interface.
6564
*
66-
* @param string $route
67-
* @param mixed $parameters
68-
* @param integer $statusCode
69-
* @param array $headers
65+
* @param string $route
66+
* @param mixed $parameters
67+
* @param int $statusCode
68+
* @param array $headers
7069
*
7170
* @return View
7271
*/
@@ -76,7 +75,7 @@ protected function routeRedirectView($route, array $parameters = array(), $statu
7675
}
7776

7877
/**
79-
* Convert view into a response object.
78+
* Converts view into a response object.
8079
*
8180
* Not necessary to use, if you are using the "ViewResponseListener", which
8281
* does this conversion automatically in kernel event "onKernelView".

Decoder/ContainerDecoderProvider.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@
1414
use Symfony\Component\DependencyInjection\ContainerAware;
1515

1616
/**
17-
* Provides encoders through the Symfony2 DIC
17+
* Provides encoders through the Symfony2 DIC.
1818
*
1919
* @author Igor Wiedler <[email protected]>
2020
*/
2121
class ContainerDecoderProvider extends ContainerAware implements DecoderProviderInterface
2222
{
23-
/**
24-
* @var array
25-
*/
2623
private $decoders;
2724

2825
/**
@@ -36,20 +33,15 @@ public function __construct(array $decoders)
3633
}
3734

3835
/**
39-
* @param string $format format
40-
*
41-
* @return boolean
36+
* {@inheritdoc}
4237
*/
4338
public function supports($format)
4439
{
4540
return isset($this->decoders[$format]);
4641
}
4742

4843
/**
49-
* @param string $format format
50-
*
51-
* @throws \InvalidArgumentException
52-
* @return \FOS\RestBundle\Decoder\DecoderInterface
44+
* {@inheritdoc}
5345
*/
5446
public function getDecoder($format)
5547
{

Decoder/DecoderInterface.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
interface DecoderInterface
2020
{
2121
/**
22-
* Decodes a string into PHP data
22+
* Decodes a string into PHP data.
2323
*
24-
* @param string $data data to decode
24+
* @param string $data
2525
*
26-
* @return array|Boolean false in case the content could not be decoded, else an array
26+
* @return array|bool False in case the content could not be decoded, else an array
2727
*/
2828
public function decode($data);
2929
}

Decoder/DecoderProviderInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@
1919
interface DecoderProviderInterface
2020
{
2121
/**
22-
* Check if a certain format is supported.
22+
* Checks if a certain format is supported.
2323
*
24-
* @param string $format Format for the requested decoder.
24+
* @param string $format
2525
*
26-
* @return boolean
26+
* @return bool
2727
*/
2828
public function supports($format);
2929

3030
/**
3131
* Provides decoders, possibly lazily.
3232
*
33-
* @param string $format Format for the requested decoder.
33+
* @param string $format
3434
*
3535
* @return \FOS\RestBundle\Decoder\DecoderInterface
3636
*/

Decoder/JsonDecoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace FOS\RestBundle\Decoder;
1313

1414
/**
15-
* Decodes JSON data
15+
* Decodes JSON data.
1616
*
1717
* @author Jordi Boggiano <[email protected]>
1818
*/

Decoder/JsonToFormDecoder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace FOS\RestBundle\Decoder;
1313

1414
/**
15-
* Decodes JSON data and make it compliant with application/x-www-form-encoded style
15+
* Decodes JSON data and make it compliant with application/x-www-form-encoded style.
1616
*
1717
* @author Kévin Dunglas <[email protected]>
1818
*/

0 commit comments

Comments
 (0)