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.

TaskQueue   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 35
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 8 2
A run() 0 6 2
1
<?php
2
3
namespace TaskQueue;
4
5
use TaskQueue\Invoker\InvokerInterface;
6
7
class TaskQueue implements TaskQueueInterface
8
{
9
    /**
10
     * @var array
11
     */
12
    private $tasks = [];
13
14
    /**
15
     * Add callbacks or \Closure into task queueing stack.
16
     *
17
     * @param InvokerInterface $invoker
18
     * @param array $taskArgs The callback or Closure arguments.
19
     * @return TaskQueueInterface
20
     */
21
    public function add(InvokerInterface $invoker, $taskArgs = [])
22
    {
23
        $taskArgs = (is_array($taskArgs) ? $taskArgs : array_slice(func_get_args(), 1));
24
25
        array_unshift($this->tasks, compact('invoker', 'taskArgs'));
26
27
        return $this;
28
    }
29
30
    /**
31
     * Invoke all of pending task in the task queueing stack.
32
     *
33
     * @return void
34
     */
35
    public function run()
36
    {
37
        while ($eachTasks = array_shift($this->tasks)) {
38
            $eachTasks['invoker']->invokeWithArgs($eachTasks['taskArgs']);
39
        }
40
    }
41
}
42