GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#544)
by Asmir
04:25
created

BasicSerializerFunctionsProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 40%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 26
ccs 6
cts 15
cp 0.4
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFunctions() 0 23 1
1
<?php
2
3
namespace JMS\SerializerBundle\ExpressionLanguage;
4
5
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
6
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
7
8
class BasicSerializerFunctionsProvider implements ExpressionFunctionProviderInterface
9
{
10 2
    public function getFunctions()
11
    {
12
        return [
13
            new ExpressionFunction('service', function ($arg) {
14
                return sprintf('$this->get(%s)', $arg);
15
            }, function (array $variables, $value) {
16
                return $variables['container']->get($value);
17 2
            }),
18
            new ExpressionFunction('parameter', function ($arg) {
19
                return sprintf('$this->getParameter(%s)', $arg);
20
            }, function (array $variables, $value) {
21
                return $variables['container']->getParameter($value);
22 2
            }),
23
            new ExpressionFunction('is_granted', function ($attribute, $object = null) {
24
                return sprintf('call_user_func_array(array($this->get(security.authorization_checker), isGranted), array(%s, %s))', $attribute, $object);
25 2
            }, function (array $variables, $attribute, $object = null) {
26
                return call_user_func_array(
27
                    array($variables['container']->get('security.authorization_checker'), 'isGranted'),
28
                    [$attribute, $object]
29
                );
30 2
            }),
31 2
        ];
32
    }
33
}
34