Factory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 0
dl 0
loc 16
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A newProcess() 0 5 1
1
<?php
2
/**
3
 * This file is part of cocur/background-process.
4
 *
5
 * (c) 2013-2104 Florian Eckerstorfer
6
 */
7
8
namespace Cocur\BackgroundProcess;
9
10
/**
11
 * Factory to create BackgroundProcess objects.
12
 *
13
 * @package   cocur/background-process
14
 * @author    Florian Eckerstorfer <[email protected]>
15
 * @copyright 2013-2014 Florian Eckerstorfer
16
 * @license   http://opensource.org/licenses/MIT The MIT License
17
 * @link      http://braincrafted.com/php-background-processes/ Running background processes in PHP
18
 */
19
class Factory
20
{
21
    /** @var string */
22
    private $className;
23
24 1
    public function __construct($className)
25
    {
26 1
        $this->className = $className;
27 1
    }
28
29 1
    public function newProcess($command)
30
    {
31 1
        $className = $this->className;
32 1
        return new $className($command);
33
    }
34
}
35