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 (#158)
by Bernardo Vieira da
12:24
created

JobCollection::toArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 4
cts 5
cp 0.8
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2.032
1
<?php
2
3
/**
4
 * Gearman Bundle for Symfony2
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * Feel free to edit as you please, and have fun.
10
 *
11
 * @author Marc Morera <[email protected]>
12
 */
13
14
namespace Mmoreram\GearmanBundle\Module;
15
16
use Mmoreram\GearmanBundle\Module\JobClass as Job;
17
18
/**
19
 * Job Collection class
20
 *
21
 * @since 2.3.1
22
 */
23
class JobCollection
24
{
25
    /**
26
     * @var array
27
     *
28
     * All jobs from worker
29
     */
30
    private $workerJobs = array();
31
32
    /**
33
     * Adds into $workerJobs a Job instance
34
     * Return self object
35
     *
36
     * @param Job $workJob Class to add into array
37
     *
38
     * @return JobCollection
39
     */
40
    public function add(Job $workJob)
41
    {
42
        $this->workerJobs[] = $workJob;
43
44
        return $this;
45
    }
46
47
    /**
48
     * Retrieve all Jobs added previously
49
     *
50
     * @return array
51
     */
52
    public function getJobs()
53
    {
54
        return $this->workerJobs;
55
    }
56
57
    /**
58
     * Retrieve all jobs loaded previously in cache format
59
     *
60
     * @return array
61
     */
62 3
    public function toArray()
63
    {
64 3
        $jobs = array();
65
66 3
        foreach ($this->workerJobs as $job) {
67
68
            $jobs[] = $job->toArray();
69
        }
70
71 3
        return $jobs;
72
    }
73
}
74