| Total Complexity | 9 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Coverage | 85.71% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class PermessiTwigExtension extends \Twig_Extension |
||
| 6 | { |
||
| 7 | |||
| 8 | protected $requeststack; |
||
| 9 | protected $container; |
||
| 10 | |||
| 11 | 32 | public function __construct($container, $request_stack) |
|
| 12 | { |
||
| 13 | 32 | $this->container = $container; |
|
|
|
|||
| 14 | 32 | $this->requeststack = $request_stack; |
|
| 15 | 32 | } |
|
| 16 | |||
| 17 | /** |
||
| 18 | * Get current controller name. |
||
| 19 | */ |
||
| 20 | 4 | public function getControllerName() |
|
| 21 | { |
||
| 22 | 4 | $pattern = "#Controller\\\([a-zA-Z]*)Controller#"; |
|
| 23 | 4 | $matches = array(); |
|
| 24 | 4 | preg_match($pattern, $this->requeststack->getCurrentRequest()->get('_controller'), $matches); |
|
| 25 | |||
| 26 | 4 | return $matches[1]; |
|
| 27 | } |
||
| 28 | |||
| 29 | 11 | public function getFunctions() |
|
| 30 | { |
||
| 31 | return array( |
||
| 32 | //'permesso' => new \Twig_Function_Method($this, 'controllaPermesso'), |
||
| 33 | 11 | ); |
|
| 34 | } |
||
| 35 | |||
| 36 | 11 | public function getFilters() |
|
| 40 | 11 | ); |
|
| 41 | } |
||
| 42 | |||
| 43 | 4 | public function singoloPermesso($lettera) |
|
| 64 | } |
||
| 65 | } |
||
| 67 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.