1 | <?php |
||
17 | abstract class AbstractJobComparisionBusinessCase implements JobComparisonInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var JobRepositoryInterface |
||
21 | */ |
||
22 | protected $oRemoteRepository; |
||
23 | /** |
||
24 | * @var JobRepositoryInterface |
||
25 | */ |
||
26 | protected $oLocalRepository; |
||
27 | /** |
||
28 | * @var DiffCompareInterface |
||
29 | */ |
||
30 | protected $oDiffCompare; |
||
31 | |||
32 | /** |
||
33 | * @inheritdoc |
||
34 | */ |
||
35 | 1 | public function getLocalMissingJobs() |
|
36 | { |
||
37 | 1 | return $this->getMissingJobsInCollectionA( |
|
38 | 1 | $this->oLocalRepository->getJobs(), |
|
39 | 1 | $this->oRemoteRepository->getJobs() |
|
40 | ); |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @inheritdoc |
||
45 | */ |
||
46 | 1 | public function getRemoteMissingJobs() |
|
47 | { |
||
48 | 1 | return $this->getMissingJobsInCollectionA( |
|
49 | 1 | $this->oRemoteRepository->getJobs(), |
|
50 | 1 | $this->oLocalRepository->getJobs() |
|
51 | ); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @inheritdoc |
||
56 | */ |
||
57 | 1 | public function isJobAvailable($sJobName) |
|
63 | |||
64 | |||
65 | /** |
||
66 | * @param JobCollection $oJobCollectionA |
||
67 | * @param JobCollection $oJobCollectionB |
||
68 | * @return array<string> |
||
|
|||
69 | */ |
||
70 | 2 | protected function getMissingJobsInCollectionA(JobCollection $oJobCollectionA, JobCollection $oJobCollectionB) |
|
77 | |||
78 | 9 | protected function getDifference(JobEntityInterface $oJobEntityA, JobEntityInterface $oJobEntityB) |
|
104 | |||
105 | |||
106 | /** |
||
107 | * @param JobEntityInterface $oJobEntityA |
||
108 | * @param JobEntityInterface $oJobEntityB |
||
109 | * @return array |
||
110 | */ |
||
111 | 9 | protected function compareJobEntities(JobEntityInterface $oJobEntityA, JobEntityInterface $oJobEntityB) |
|
132 | |||
133 | |||
134 | /** |
||
135 | * @inheritdoc |
||
136 | */ |
||
137 | 2 | public function getJobDiff($sJobName) |
|
175 | |||
176 | |||
177 | |||
178 | /** |
||
179 | * @inheritdoc |
||
180 | */ |
||
181 | 7 | public function getLocalJobUpdates() |
|
209 | |||
210 | |||
211 | /** |
||
212 | * This method should perform any operation that is desired before comparing remote and local entities. |
||
213 | * Why this is required? |
||
214 | * For system like marathon, it is essential to set/unset certain values before comparing to make sane |
||
215 | * comparision. |
||
216 | * |
||
217 | * Note: Should be careful with the parameters as they are passed by value. |
||
218 | * |
||
219 | * @param JobEntityInterface $oLocalJob |
||
220 | * @param JobEntityInterface $oRemoteJob |
||
221 | * @return null |
||
222 | */ |
||
223 | abstract protected function preCompareModifications(JobEntityInterface &$oLocalJob, JobEntityInterface &$oRemoteJob); |
||
224 | |||
225 | /** |
||
226 | * Gets entity for each system with defaults set |
||
227 | * @return JobEntityInterface |
||
228 | */ |
||
229 | abstract protected function getEntitySetWithDefaults(); |
||
230 | |||
231 | /** |
||
232 | * Verify if two entities are equal. |
||
233 | * |
||
234 | * @param $sProperty |
||
235 | * @param JobEntityInterface $oJobEntityA |
||
236 | * @param JobEntityInterface $oJobEntityB |
||
237 | * @return mixed |
||
238 | */ |
||
239 | abstract protected function isEntityEqual($sProperty, JobEntityInterface $oJobEntityA, JobEntityInterface $oJobEntityB); |
||
240 | |||
241 | /** |
||
242 | * @param JobEntityInterface $oJobEntityA |
||
243 | * @param JobEntityInterface $oJobEntityB |
||
244 | * @return bool |
||
245 | */ |
||
246 | abstract public function hasSameJobType(JobEntityInterface $oJobEntityA, JobEntityInterface $oJobEntityB); |
||
247 | } |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.