Factory::newProcess()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 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