Completed
Push — master ( b85f9d...1fa11a )
by Akihito
02:52
created

ActiveWorkerSet::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace Ackintosh\Snidel;
3
4
class ActiveWorkerSet
5
{
6
    /** @var \Ackintosh\Snidel\Worker[] */
7
    private $workers = array();
8
9
    public function add($worker)
10
    {
11
        $this->workers[$worker->getPid()] = $worker;
12
    }
13
14
    /**
15
     * @param   int     $pid
16
     * @return  void
17
     */
18
    public function delete($pid)
19
    {
20
        unset($this->workers[$pid]);
21
    }
22
23
    /**
24
     * @return  int
25
     */
26
    public function count()
27
    {
28
        return count($this->workers);
29
    }
30
31
    /**
32
     * @return  \Ackintosh\Snidel\Worker[]
33
     */
34
    public function toArray()
35
    {
36
        return $this->workers;
37
    }
38
}
39