| 1 | <?php |
||
| 5 | class FallbackPackage |
||
| 6 | { |
||
| 7 | private $patterns; |
||
| 8 | private $package; |
||
| 9 | private $fallback; |
||
| 10 | |||
| 11 | 9 | public function __construct($patterns, $package) |
|
| 16 | |||
| 17 | 9 | public function setFallback($fallback) |
|
| 23 | |||
| 24 | public function getVersion($path) |
||
| 25 | { |
||
| 26 | if ($this->mustFallback($path)) { |
||
| 27 | return $this->fallback->getVersion($path); |
||
| 28 | } |
||
| 29 | |||
| 30 | return $this->package->getVersion($path); |
||
| 31 | } |
||
| 32 | |||
| 33 | 4 | public function getUrl($path, $version = null) |
|
| 41 | |||
| 42 | 4 | protected function mustFallback($path) |
|
| 52 | } |
||
| 53 |
It is generally a best practice as it is often more readable to use concatenation instead of interpolation for variables inside strings.