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 — 3.0 ( 556c32...858d73 )
by Vermeulen
02:59
created

RunTasks::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace BFW;
4
5
class RunTasks extends Subjects
6
{
7
    /**
8
     * @var array[] $runSteps All steps used for run the application
9
     */
10
    protected $runSteps;
11
    
12
    /**
13
     * @var string $notifyPrefix A prefix to use for task name
14
     */
15
    protected $notifyPrefix;
16
    
17
    /**
18
     * Constructor
19
     * 
20
     * @param \stdClass[] $runSteps All step to call
21
     * @param string $notifyPrefix The prefix to use for task name
22
     */
23
    public function __construct($runSteps, $notifyPrefix)
24
    {
25
        $this->runSteps     = $runSteps;
0 ignored issues
show
Documentation Bug introduced by
It seems like $runSteps of type array<integer,object<stdClass>> is incompatible with the declared type array<integer,array> of property $runSteps.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
26
        $this->notifyPrefix = $notifyPrefix;
27
    }
28
    
29
    /**
30
     * Getter to access to the run step array
31
     * 
32
     * @return array
33
     */
34
    public function getRunSteps()
35
    {
36
        return $this->runSteps;
37
    }
38
    
39
    /**
40
     * Setter to re-define the run step array
41
     * 
42
     * @param \stdObject[] $runSteps The new list of run steps
43
     * 
44
     * @return $this
45
     */
46
    public function setRunSteps($runSteps)
47
    {
48
        $this->runSteps = $runSteps;
0 ignored issues
show
Documentation Bug introduced by
It seems like $runSteps of type array<integer,object<stdObject>> is incompatible with the declared type array<integer,array> of property $runSteps.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
49
        return $this;
50
    }
51
    
52
    /**
53
     * Add a new run step to the list
54
     * 
55
     * @param string    $name          The name of the new run step
56
     * @param \stdClass $runStepsToAdd The run step to add
57
     * 
58
     * @return $this
59
     */
60
    public function addToRunSteps($name, \stdClass $runStepsToAdd)
61
    {
62
        $this->runSteps[(string) $name] = $runStepsToAdd;
63
        return $this;
64
    }
65
    
66
    /**
67
     * Getter to property notifyPrefix
68
     * 
69
     * @return string
70
     */
71
    public function getNotifyPrefix()
72
    {
73
        return $this->notifyPrefix;
74
    }
75
    
76
    /**
77
     * Setter to re-define the notifyPrefix
78
     * 
79
     * @param string $notifyPrefix
80
     * 
81
     * @return $this
82
     */
83
    public function setNotifyPrefix($notifyPrefix)
84
    {
85
        $this->notifyPrefix = (string) $notifyPrefix;
86
        return $this;
87
    }
88
    
89
    /**
90
     * Run all steps declared and notify for each step
91
     * Call the callback if declared for each step
92
     * 
93
     * @return void
94
     */
95
    public function run()
96
    {
97
        $prefix = $this->notifyPrefix;
98
        
99
        $this->addNotification($prefix.'_start_run_tasks');
100
        
101
        foreach ($this->runSteps as $actionName => $stepInfos) {
102
            $context = null;
103
            if (property_exists($stepInfos, 'context')) {
104
                $context = $stepInfos->context;
105
            }
106
            
107
            if (!property_exists($stepInfos, 'callback')) {
108
                $this->addNotification($prefix.'_exec_'.$actionName, $context);
109
                continue;
110
            }
111
            
112
            $this->addNotification($prefix.'_run_'.$actionName, $context);
113
114
            if (is_callable($stepInfos->callback)) {
115
                $callback = $stepInfos->callback;
116
                $callback();
117
            }
118
119
            $this->addNotification($prefix.'_finish_'.$actionName, $context);
120
        }
121
        
122
        $this->addNotification($prefix.'_end_run_tasks');
123
    }
124
    
125
    /**
126
     * Send a notification to all observers connected to the subject
127
     * 
128
     * @param string $action The action name
129
     * @param mixed $context (default null) The context to pass to the subject
130
     * 
131
     * @return void
132
     */
133
    public function sendNotify($action, $context = null)
134
    {
135
        $this->addNotification($action, $context);
136
    }
137
}
138