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 — dev ( 925885...2441e9 )
by Андрей
06:27
created

Functions::executeFunction()   B

Complexity

Conditions 4
Paths 4

Size

Total Lines 28
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 4.2084

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 28
ccs 13
cts 17
cp 0.7647
rs 8.5806
cc 4
eloc 16
nc 4
nop 3
crap 4.2084
1
<?php
2
/**
3
 * @link https://github.com/old-town/old-town-workflow
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace OldTown\Workflow\Engine;
7
8
use OldTown\PropertySet\PropertySetInterface;
9
use OldTown\Workflow\Exception\InternalWorkflowException;
10
use OldTown\Workflow\Exception\WorkflowException;
11
use OldTown\Workflow\Loader\FunctionDescriptor;
12
use OldTown\Workflow\TransientVars\TransientVarsInterface;
13
14
15
/**
16
 * Class Functions
17
 *
18
 * @package OldTown\Workflow\Engine
19
 */
20
class Functions extends AbstractEngine implements FunctionsInterface
21
{
22
    /**
23
     * @param FunctionDescriptor $function
24
     * @param TransientVarsInterface $transientVars
25
     * @param PropertySetInterface $ps
26
     *
27
     * @throws WorkflowException
28
     * @throws InternalWorkflowException
29
     */
30 4
    public function executeFunction(FunctionDescriptor $function, TransientVarsInterface $transientVars, PropertySetInterface $ps)
31
    {
32 4
        if (null !== $function) {
33 4
            $type = $function->getType();
34
35 4
            $argsOriginal = $function->getArgs();
36
37 4
            $workflowManager = $this->getWorkflowManager();
38
39 4
            $args = $workflowManager->getEngineManager()->getArgsEngine()->prepareArgs($argsOriginal, $transientVars, $ps);
40
41 4
            $provider = $workflowManager->getResolver()->getFunction($type, $args);
42
43 4
            if (null === $provider) {
44 1
                $workflowManager->getContext()->setRollbackOnly();
45
                $errMsg = 'Не загружен провайдер для функции';
46
                throw new WorkflowException($errMsg);
47
            }
48
49
            try {
50 4
                $provider->execute($transientVars, $args, $ps);
51 4
            } catch (WorkflowException $e) {
52
                $workflowManager->getContext()->setRollbackOnly();
53
                /** @var  WorkflowException $e*/
54
                throw $e;
55
            }
56 4
        }
57 4
    }
58
}
59