PoolFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 25%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 4
dl 0
loc 45
ccs 2
cts 8
cp 0.25
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A newPool() 0 4 1
A newFixedPool() 0 4 1
A newParallelPool() 0 4 1
A newSinglePool() 0 4 1
1
<?php
2
/**
3
 * @author Jenner <[email protected]>
4
 * @blog http://www.huyanping.cn
5
 * @license https://opensource.org/licenses/MIT MIT
6
 * @datetime: 2015/11/19 21:14
7
 */
8
9
namespace Jenner\SimpleFork;
10
11
12
class PoolFactory
13
{
14
    /**
15
     * create a pool instance
16
     *
17
     * @return Pool
18
     */
19
    public static function newPool()
20
    {
21
        return new Pool();
22
    }
23
24
    /**
25
     * create a fixed pool instance
26
     *
27
     * @param int $max
28
     * @return FixedPool
29
     */
30 3
    public static function newFixedPool($max = 4)
31
    {
32 3
        return new FixedPool($max);
33
    }
34
35
    /**
36
     * create a parallel pool instance
37
     *
38
     * @param $callback
39
     * @param int $max
40
     * @return ParallelPool
41
     */
42
    public static function newParallelPool($callback, $max = 4)
43
    {
44
        return new ParallelPool($callback, $max);
45
    }
46
47
    /**
48
     * create a single pool
49
     *
50
     * @return SinglePool
51
     */
52
    public static function newSinglePool()
53
    {
54
        return new SinglePool();
55
    }
56
}