1 | <?php |
||
19 | class CommandFactory |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * Reference to configuration. |
||
24 | * |
||
25 | * @var ConfigEditor |
||
26 | */ |
||
27 | private $_configEditor; |
||
28 | |||
29 | /** |
||
30 | * Process factory. |
||
31 | * |
||
32 | * @var IProcessFactory |
||
33 | */ |
||
34 | private $_processFactory; |
||
35 | |||
36 | /** |
||
37 | * Console IO. |
||
38 | * |
||
39 | * @var ConsoleIO |
||
40 | */ |
||
41 | private $_io; |
||
42 | |||
43 | /** |
||
44 | * Cache manager. |
||
45 | * |
||
46 | * @var CacheManager |
||
47 | */ |
||
48 | private $_cacheManager; |
||
49 | |||
50 | /** |
||
51 | * Path to an svn command. |
||
52 | * |
||
53 | * @var string |
||
54 | */ |
||
55 | private $_svnCommand = 'svn'; |
||
56 | |||
57 | /** |
||
58 | * Creates command factory. |
||
59 | * |
||
60 | * @param ConfigEditor $config_editor ConfigEditor. |
||
61 | * @param IProcessFactory $process_factory Process factory. |
||
62 | * @param ConsoleIO $io Console IO. |
||
63 | * @param CacheManager $cache_manager Cache manager. |
||
64 | */ |
||
65 | 19 | public function __construct( |
|
78 | |||
79 | /** |
||
80 | * Prepares static part of svn command to be used across the script. |
||
81 | * |
||
82 | * @return void |
||
83 | */ |
||
84 | 19 | protected function prepareSvnCommand() |
|
99 | |||
100 | /** |
||
101 | * Builds a command. |
||
102 | * |
||
103 | * @param string $sub_command Sub command. |
||
104 | * @param string|null $param_string Parameter string. |
||
105 | * |
||
106 | * @return Command |
||
107 | */ |
||
108 | 10 | public function getCommand($sub_command, $param_string = null) |
|
119 | |||
120 | /** |
||
121 | * Builds command from given arguments. |
||
122 | * |
||
123 | * @param string $sub_command Command. |
||
124 | * @param string $param_string Parameter string. |
||
125 | * |
||
126 | * @return string |
||
127 | * @throws \InvalidArgumentException When command contains spaces. |
||
128 | */ |
||
129 | 10 | protected function buildCommand($sub_command, $param_string = null) |
|
155 | |||
156 | } |
||
157 |