1 | <?php |
||
22 | class PuliStrategy implements StrategyInterface |
||
23 | { |
||
24 | const ANY = 'any'; |
||
25 | const STABLE = 'stable'; |
||
26 | const UNSTABLE = 'unstable'; |
||
27 | |||
28 | const MANIFEST = 'https://puli.io/download/versions.json'; |
||
29 | const REMOTE_PHAR = 'https://puli.io/download/%s/puli.phar'; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | private static $stabilities = array( |
||
35 | self::STABLE, |
||
36 | self::UNSTABLE, |
||
37 | self::ANY, |
||
38 | ); |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | private $stability = self::ANY; |
||
44 | |||
45 | /** |
||
46 | * Download the remote Phar file. |
||
47 | * |
||
48 | * @param Updater $updater |
||
49 | */ |
||
50 | 1 | public function download(Updater $updater) |
|
71 | |||
72 | /** |
||
73 | * Retrieve the current version available remotely. |
||
74 | * |
||
75 | * @param Updater $updater |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | 2 | public function getCurrentRemoteVersion(Updater $updater) |
|
104 | |||
105 | /** |
||
106 | * Retrieve the current version of the local phar file. |
||
107 | * |
||
108 | * @param Updater $updater |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | 1 | public function getCurrentLocalVersion(Updater $updater) |
|
116 | |||
117 | /** |
||
118 | * Set target stability. |
||
119 | * |
||
120 | * @param string $stability |
||
121 | */ |
||
122 | 6 | public function setStability($stability) |
|
132 | |||
133 | /** |
||
134 | * Get target stability. |
||
135 | * |
||
136 | * @return string |
||
137 | */ |
||
138 | 5 | public function getStability() |
|
142 | |||
143 | /** |
||
144 | * Get a remote file content securely using composer/ca-bundle to find the local ca-file. |
||
145 | * |
||
146 | * @param string $remoteUrl |
||
147 | * @return string |
||
148 | */ |
||
149 | 1 | private function secureFileGetContents($remoteUrl) |
|
167 | } |
||
168 |