1 | <?php |
||
33 | class Job |
||
34 | { |
||
35 | /** |
||
36 | * @var EventDispatcherInterface |
||
37 | */ |
||
38 | protected $dispatcher; |
||
39 | |||
40 | /** |
||
41 | * @var VersioningInterface |
||
42 | */ |
||
43 | protected $versioning = null; |
||
44 | |||
45 | /** |
||
46 | * @var ActionInterface |
||
47 | */ |
||
48 | protected $action; |
||
49 | |||
50 | /** |
||
51 | * @var string |
||
52 | */ |
||
53 | protected $source_url; |
||
54 | |||
55 | /** |
||
56 | * @var array |
||
57 | */ |
||
58 | protected $source_options; |
||
59 | |||
60 | /** |
||
61 | * @var array |
||
62 | */ |
||
63 | protected $patterns = array(); |
||
64 | |||
65 | /** |
||
66 | * @var boolean |
||
67 | */ |
||
68 | protected $pattern_nested = false; |
||
69 | |||
70 | /** |
||
71 | * @var string |
||
72 | */ |
||
73 | protected $workingDirectory = ''; |
||
74 | |||
75 | /** |
||
76 | */ |
||
77 | public function __construct() |
||
78 | { |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * @return Job |
||
83 | */ |
||
84 | public function checkoutRepository() |
||
85 | { |
||
86 | $this->getVersioning()->prepare($this->source_url); |
||
87 | $workingDirectory = $this->getVersioning()->getWorkingDirectory(); |
||
88 | $this->getVersioning()->process($this->source_url, $workingDirectory, $this->source_options); |
||
89 | |||
90 | return $workingDirectory; |
||
91 | } |
||
92 | |||
93 | /** |
||
94 | * @return VersioningInterface |
||
95 | */ |
||
96 | public function getVersioning() |
||
97 | { |
||
98 | return $this->versioning; |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * @param VersioningInterface $versioning |
||
103 | * |
||
104 | * @return Job |
||
105 | */ |
||
106 | public function setVersioning(VersioningInterface $versioning) |
||
107 | { |
||
108 | $this->versioning = $versioning; |
||
109 | |||
110 | return $this; |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * @return ActionInterface |
||
115 | */ |
||
116 | public function getAction() |
||
120 | |||
121 | /** |
||
122 | * @param ActionInterface $action |
||
123 | */ |
||
124 | public function setAction($action) |
||
128 | |||
129 | /** |
||
130 | * Gets the dispatcher used by this library to dispatch events. |
||
131 | * |
||
132 | * @return EventDispatcherInterface |
||
133 | */ |
||
134 | public function getDispatcher() |
||
142 | |||
143 | /** |
||
144 | * Sets the dispatcher used by this library to dispatch events. |
||
145 | * |
||
146 | * @param EventDispatcherInterface $dispatcher |
||
147 | * The Symfony event dispatcher object. |
||
148 | * |
||
149 | * @return $this |
||
150 | */ |
||
151 | public function setDispatcher(EventDispatcherInterface $dispatcher) |
||
157 | |||
158 | /** |
||
159 | * @return array |
||
160 | */ |
||
161 | public function getPatterns() |
||
165 | |||
166 | /** |
||
167 | * @param array $patterns |
||
168 | * @param boolean $nested |
||
169 | * |
||
170 | * @return Job |
||
171 | */ |
||
172 | public function setPatterns($patterns, $nested = false) |
||
179 | |||
180 | /** |
||
181 | * @return boolean |
||
182 | */ |
||
183 | public function isPatternNested() |
||
187 | |||
188 | /** |
||
189 | * @param string $url |
||
190 | * @param array $options |
||
191 | */ |
||
192 | public function setSource($url, $options = array()) |
||
197 | } |
||
198 |