@@ 326-339 (lines=14) @@ | ||
323 | * @return string Version number that meets the requirement. |
|
324 | * @throws RuntimeException If the requirement could not be satisfied. |
|
325 | */ |
|
326 | protected function getLesserThanVersion($milestone) |
|
327 | { |
|
328 | if (version_compare($this->version->getVersion(), $milestone, '<')) { |
|
329 | return $this->version->getVersion(); |
|
330 | } |
|
331 | $data = array_reverse($this->releases->getAll()); |
|
332 | foreach ($data as $version => $date) { |
|
333 | if (version_compare($version, $milestone, '<')) { |
|
334 | return $version; |
|
335 | } |
|
336 | } |
|
337 | ||
338 | throw new RuntimeException('Could not satisfy version requirements.'); |
|
339 | } |
|
340 | ||
341 | /** |
|
342 | * Get a version greater or equal than the milestone. |
|
@@ 375-389 (lines=15) @@ | ||
372 | * |
|
373 | * @return string Version number that meets the requirement. |
|
374 | */ |
|
375 | protected function getLesserEqualVersion($milestone) |
|
376 | { |
|
377 | if (version_compare($this->version->getVersion(), $milestone, '<=')) { |
|
378 | return $this->version->getVersion(); |
|
379 | } |
|
380 | ||
381 | $data = array_reverse($this->releases->getAll()); |
|
382 | foreach ($data as $version => $date) { |
|
383 | if (version_compare($version, $milestone, '<=')) { |
|
384 | return $version; |
|
385 | } |
|
386 | } |
|
387 | ||
388 | throw new RuntimeException('Could not satisfy version requirements.'); |
|
389 | } |
|
390 | } |
|
391 |