| @@ 36-45 (lines=10) @@ | ||
| 33 | * |
|
| 34 | * @return PuliResource |
|
| 35 | */ |
|
| 36 | public function getCurrentVersion() |
|
| 37 | { |
|
| 38 | $stack = $this->toArray(); |
|
| 39 | ||
| 40 | if (!is_array($stack) || 0 === count($stack)) { |
|
| 41 | throw new RuntimeException('Impossible to find the current version of an empty stack.'); |
|
| 42 | } |
|
| 43 | ||
| 44 | return end($stack); |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Get the first version from the stack. |
|
| @@ 52-61 (lines=10) @@ | ||
| 49 | * |
|
| 50 | * @return PuliResource |
|
| 51 | */ |
|
| 52 | public function getFirstVersion() |
|
| 53 | { |
|
| 54 | $stack = $this->toArray(); |
|
| 55 | ||
| 56 | if (!is_array($stack) || 0 === count($stack)) { |
|
| 57 | throw new RuntimeException('Impossible to find the first version of an empty stack.'); |
|
| 58 | } |
|
| 59 | ||
| 60 | return reset($stack); |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * Get a specific version from the stack. |
|