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
Push — master ( aa4ff3...5266c0 )
by Alex
22:35
created

ActionExpressionLanguage::__construct()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 33
Code Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 21
nc 2
nop 5
1
<?php
2
/**
3
 * This file is part of the Global Trading Technologies Ltd workflow-extension-bundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * (c) fduch <[email protected]>
9
 *
10
 * Date: 01.09.16
11
 */
12
13
namespace Gtt\Bundle\WorkflowExtensionsBundle\Action\ExpressionLanguage;
14
15
use Gtt\Bundle\WorkflowExtensionsBundle\Action\Registry;
16
use Gtt\Bundle\WorkflowExtensionsBundle\Action\Executor;
17
use Gtt\Bundle\WorkflowExtensionsBundle\ExpressionLanguage\ContainerAwareExpressionLanguage;
18
use Symfony\Component\DependencyInjection\ContainerInterface;
19
use Symfony\Component\ExpressionLanguage\ParserCache\ParserCacheInterface;
20
21
/**
22
 * Expression language allows to use actions inside expressions
23
 *
24
 * @author fduch <[email protected]>
25
 */
26
class ActionExpressionLanguage extends ContainerAwareExpressionLanguage
27
{
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function __construct(
32
        Registry $actionRegistry,
33
        Executor $actionExecutor,
34
        ContainerInterface $container,
35
        ParserCacheInterface $cache = null,
36
        array $providers = array())
37
    {
38
        parent::__construct($container, $cache, $providers);
39
40
        foreach ($actionRegistry as $actionName => $action) {
41
            $this->register(
42
                $actionName,
43
                function () use ($actionName, $actionExecutor)
44
                {
45
                    $rawArgs           = func_get_args();
46
                    $compiledArgsArray = "array(". implode(", ", $rawArgs) . ")";
47
48
                    return sprintf(
49
                        '$container->get("gtt.workflow.action.executor")->execute($workflowContext, "%s", %s)',
50
                        $actionName,
51
                        $compiledArgsArray
52
                    );
53
                },
54
                function () use ($actionName, $actionExecutor)
55
                {
56
                    $args      = func_get_args();
57
                    $variables = array_shift($args);
58
59
                    return $actionExecutor->execute($variables['workflowContext'], $actionName, $args);
60
                }
61
            );
62
        }
63
    }
64
}
65