1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author stev leibelt <[email protected]> |
4
|
|
|
* @since 2015-06-04 |
5
|
|
|
*/ |
6
|
|
|
|
7
|
|
|
namespace NetBazzlineZfCliGenerator\Service; |
8
|
|
|
|
9
|
|
|
use Net\Bazzline\Component\Command\Command; |
10
|
|
|
use Net\Bazzline\Component\ProcessPipe\Pipe; |
11
|
|
|
use NetBazzlineZfCliGenerator\Service\ProcessPipe\Filter\RemoveColorsAndModuleHeadlines; |
12
|
|
|
use NetBazzlineZfCliGenerator\Service\ProcessPipe\Filter\RemoveFirstLinesAndLastLine; |
13
|
|
|
use NetBazzlineZfCliGenerator\Service\ProcessPipe\Filter\RemoveIndexDotPhpFromLines; |
14
|
|
|
use NetBazzlineZfCliGenerator\Service\ProcessPipe\Transformer\DumpConfigurationContent; |
15
|
|
|
use NetBazzlineZfCliGenerator\Service\ProcessPipe\Transformer\FetchApplicationOutput; |
16
|
|
|
use NetBazzlineZfCliGenerator\Service\ProcessPipe\Transformer\ParseToConfiguration; |
17
|
|
|
use Zend\ServiceManager\FactoryInterface; |
18
|
|
|
use Zend\ServiceManager\ServiceLocatorInterface; |
19
|
|
|
|
20
|
|
|
class GenerateConfigurationContentFactory implements FactoryInterface |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* Create service |
24
|
|
|
* |
25
|
|
|
* @param ServiceLocatorInterface $serviceLocator |
26
|
|
|
* @return mixed|\Net\Bazzline\Component\ProcessPipe\Pipe |
27
|
|
|
*/ |
28
|
|
|
public function createService(ServiceLocatorInterface $serviceLocator) |
29
|
|
|
{ |
30
|
|
|
//-------------------------------- |
31
|
|
|
//data steps |
32
|
|
|
// fetch |
33
|
|
|
// filter |
34
|
|
|
// sanitize |
35
|
|
|
// parse |
36
|
|
|
//-------------------------------- |
37
|
|
|
$fetch = new FetchApplicationOutput(); |
38
|
|
|
$dump = new DumpConfigurationContent(); |
39
|
|
|
|
40
|
|
|
$fetch->setCommand(new Command()); |
41
|
|
|
$dump->setTimestamp(time()); |
42
|
|
|
|
43
|
|
|
$pipe = new Pipe( |
44
|
|
|
//fetch data |
45
|
|
|
$fetch, |
46
|
|
|
//filter data |
47
|
|
|
new RemoveFirstLinesAndLastLine(), |
48
|
|
|
new RemoveColorsAndModuleHeadlines(), |
49
|
|
|
//sanitize data |
50
|
|
|
new RemoveIndexDotPhpFromLines(), |
51
|
|
|
//parse data |
52
|
|
|
new ParseToConfiguration(), |
53
|
|
|
$dump |
54
|
|
|
); |
55
|
|
|
|
56
|
|
|
return $pipe; |
57
|
|
|
} |
58
|
|
|
} |