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

ActiveWorkerSet   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 4 1
A delete() 0 4 1
A count() 0 4 1
A toArray() 0 4 1
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