Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403]
1 <?php 2 3 4 5 6 7 8 9 10 11 12 13 namespace Composer; 14 15 use Composer\Semver\VersionParser; 16 17 18 19 20 21 22 class InstalledVersions 23 { 24 private static $installed = array ( 25 'root' => 26 array ( 27 'pretty_version' => 'dev-master', 28 'version' => 'dev-master', 29 'aliases' => 30 array ( 31 ), 32 'reference' => '70d1b7d67bc280b21f450db41728869bd1bda8d8', 33 'name' => '__root__', 34 ), 35 'versions' => 36 array ( 37 '__root__' => 38 array ( 39 'pretty_version' => 'dev-master', 40 'version' => 'dev-master', 41 'aliases' => 42 array ( 43 ), 44 'reference' => '70d1b7d67bc280b21f450db41728869bd1bda8d8', 45 ), 46 'ezyang/htmlpurifier' => 47 array ( 48 'pretty_version' => 'v4.13.0', 49 'version' => '4.13.0.0', 50 'aliases' => 51 array ( 52 ), 53 'reference' => '08e27c97e4c6ed02f37c5b2b20488046c8d90d75', 54 ), 55 'maennchen/zipstream-php' => 56 array ( 57 'pretty_version' => '2.1.0', 58 'version' => '2.1.0.0', 59 'aliases' => 60 array ( 61 ), 62 'reference' => 'c4c5803cc1f93df3d2448478ef79394a5981cc58', 63 ), 64 'markbaker/complex' => 65 array ( 66 'pretty_version' => '2.0.0', 67 'version' => '2.0.0.0', 68 'aliases' => 69 array ( 70 ), 71 'reference' => '9999f1432fae467bc93c53f357105b4c31bb994c', 72 ), 73 'markbaker/matrix' => 74 array ( 75 'pretty_version' => '2.0.0', 76 'version' => '2.0.0.0', 77 'aliases' => 78 array ( 79 ), 80 'reference' => '9567d9c4c519fbe40de01dbd1e4469dbbb66f46a', 81 ), 82 'myclabs/php-enum' => 83 array ( 84 'pretty_version' => '1.7.7', 85 'version' => '1.7.7.0', 86 'aliases' => 87 array ( 88 ), 89 'reference' => 'd178027d1e679832db9f38248fcc7200647dc2b7', 90 ), 91 'phpoffice/phpspreadsheet' => 92 array ( 93 'pretty_version' => '1.16.0', 94 'version' => '1.16.0.0', 95 'aliases' => 96 array ( 97 ), 98 'reference' => '76d4323b85129d0c368149c831a07a3e258b2b50', 99 ), 100 'psr/http-client' => 101 array ( 102 'pretty_version' => '1.0.1', 103 'version' => '1.0.1.0', 104 'aliases' => 105 array ( 106 ), 107 'reference' => '2dfb5f6c5eff0e91e20e913f8c5452ed95b86621', 108 ), 109 'psr/http-factory' => 110 array ( 111 'pretty_version' => '1.0.1', 112 'version' => '1.0.1.0', 113 'aliases' => 114 array ( 115 ), 116 'reference' => '12ac7fcd07e5b077433f5f2bee95b3a771bf61be', 117 ), 118 'psr/http-message' => 119 array ( 120 'pretty_version' => '1.0.1', 121 'version' => '1.0.1.0', 122 'aliases' => 123 array ( 124 ), 125 'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363', 126 ), 127 'psr/simple-cache' => 128 array ( 129 'pretty_version' => '1.0.1', 130 'version' => '1.0.1.0', 131 'aliases' => 132 array ( 133 ), 134 'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b', 135 ), 136 'symfony/polyfill-mbstring' => 137 array ( 138 'pretty_version' => 'v1.22.0', 139 'version' => '1.22.0.0', 140 'aliases' => 141 array ( 142 ), 143 'reference' => 'f377a3dd1fde44d37b9831d68dc8dea3ffd28e13', 144 ), 145 ), 146 ); 147 148 149 150 151 152 153 154 public static function getInstalledPackages() 155 { 156 return array_keys(self::$installed['versions']); 157 } 158 159 160 161 162 163 164 165 166 167 public static function isInstalled($packageName) 168 { 169 return isset(self::$installed['versions'][$packageName]); 170 } 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 public static function satisfies(VersionParser $parser, $packageName, $constraint) 186 { 187 $constraint = $parser->parseConstraints($constraint); 188 $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); 189 190 return $provided->matches($constraint); 191 } 192 193 194 195 196 197 198 199 200 201 202 public static function getVersionRanges($packageName) 203 { 204 if (!isset(self::$installed['versions'][$packageName])) { 205 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 206 } 207 208 $ranges = array(); 209 if (isset(self::$installed['versions'][$packageName]['pretty_version'])) { 210 $ranges[] = self::$installed['versions'][$packageName]['pretty_version']; 211 } 212 if (array_key_exists('aliases', self::$installed['versions'][$packageName])) { 213 $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']); 214 } 215 if (array_key_exists('replaced', self::$installed['versions'][$packageName])) { 216 $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']); 217 } 218 if (array_key_exists('provided', self::$installed['versions'][$packageName])) { 219 $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']); 220 } 221 222 return implode(' || ', $ranges); 223 } 224 225 226 227 228 229 public static function getVersion($packageName) 230 { 231 if (!isset(self::$installed['versions'][$packageName])) { 232 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 233 } 234 235 if (!isset(self::$installed['versions'][$packageName]['version'])) { 236 return null; 237 } 238 239 return self::$installed['versions'][$packageName]['version']; 240 } 241 242 243 244 245 246 public static function getPrettyVersion($packageName) 247 { 248 if (!isset(self::$installed['versions'][$packageName])) { 249 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 250 } 251 252 if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) { 253 return null; 254 } 255 256 return self::$installed['versions'][$packageName]['pretty_version']; 257 } 258 259 260 261 262 263 public static function getReference($packageName) 264 { 265 if (!isset(self::$installed['versions'][$packageName])) { 266 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); 267 } 268 269 if (!isset(self::$installed['versions'][$packageName]['reference'])) { 270 return null; 271 } 272 273 return self::$installed['versions'][$packageName]['reference']; 274 } 275 276 277 278 279 280 public static function getRootPackage() 281 { 282 return self::$installed['root']; 283 } 284 285 286 287 288 289 290 291 public static function getRawData() 292 { 293 return self::$installed; 294 } 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 public static function reload($data) 315 { 316 self::$installed = $data; 317 } 318 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body