Lines Matching refs:installed
19 * This class is copied in every Composer installed project and available to all
21 * See also https://getcomposer.org/doc/07-runtime.md#installed-versions
33 private static $installed;
47 * Returns a list of all package names which are present, either by being installed, replaced or provided
55 foreach (self::getInstalled() as $installed) {
56 $packages[] = array_keys($installed['versions']);
77 foreach (self::getInstalled() as $installed) {
78 foreach ($installed['versions'] as $name => $package) {
89 * Checks whether the given package is installed
99 foreach (self::getInstalled() as $installed) {
100 if (isset($installed['versions'][$packageName])) {
101 return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
111 * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
129 * Returns a version constraint representing all the range(s) which are installed for a given package
132 * whether a given version of a package is installed, and not just whether it exists
139 foreach (self::getInstalled() as $installed) {
140 if (!isset($installed['versions'][$packageName])) {
145 if (isset($installed['versions'][$packageName]['pretty_version'])) {
146 $ranges[] = $installed['versions'][$packageName]['pretty_version'];
148 if (array_key_exists('aliases', $installed['versions'][$packageName])) {
149 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
151 if (array_key_exists('replaced', $installed['versions'][$packageName])) {
152 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
154 if (array_key_exists('provided', $installed['versions'][$packageName])) {
155 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
161 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
166 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
170 foreach (self::getInstalled() as $installed) {
171 if (!isset($installed['versions'][$packageName])) {
175 if (!isset($installed['versions'][$packageName]['version'])) {
179 return $installed['versions'][$packageName]['version'];
182 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
187 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
191 foreach (self::getInstalled() as $installed) {
192 if (!isset($installed['versions'][$packageName])) {
196 if (!isset($installed['versions'][$packageName]['pretty_version'])) {
200 return $installed['versions'][$packageName]['pretty_version'];
203 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
208 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
212 foreach (self::getInstalled() as $installed) {
213 if (!isset($installed['versions'][$packageName])) {
217 if (!isset($installed['versions'][$packageName]['reference'])) {
221 return $installed['versions'][$packageName]['reference'];
224 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
229 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
233 foreach (self::getInstalled() as $installed) {
234 if (!isset($installed['versions'][$packageName])) {
238 return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
241 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
250 $installed = self::getInstalled();
252 return $installed[0]['root'];
256 * Returns the raw installed.php data for custom implementations
266 if (null === self::$installed) {
267 // only require the installed.php file if this file is loaded from its dumped location,
270 self::$installed = include __DIR__ . '/installed.php';
272 self::$installed = array();
276 return self::$installed;
280 * Returns the raw data of all installed.php which are currently loaded for custom implementations
295 * and wants to ensure both projects have access to their version of installed.php.
299 * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
303 * @param array[] $data A vendor/composer/installed.php data set
310 self::$installed = $data;
324 $installed = array();
329 $installed[] = self::$installedByVendor[$vendorDir];
330 } elseif (is_file($vendorDir.'/composer/installed.php')) {
332 $required = require $vendorDir.'/composer/installed.php';
333 $installed[] = self::$installedByVendor[$vendorDir] = $required;
334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
335 self::$installed = $installed[count($installed) - 1];
341 if (null === self::$installed) {
342 // only require the installed.php file if this file is loaded from its dumped location,
346 $required = require __DIR__ . '/installed.php';
347 self::$installed = $required;
349 self::$installed = array();
353 if (self::$installed !== array()) {
354 $installed[] = self::$installed;
357 return $installed;