Lines Matching defs: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
31 private static $installed;
45 * Returns a list of all package names which are present, either by being installed, replaced or provided
53 foreach (self::getInstalled() as $installed) {
54 $packages[] = array_keys($installed['versions']);
75 foreach (self::getInstalled() as $installed) {
76 foreach ($installed['versions'] as $name => $package) {
87 * Checks whether the given package is installed
97 foreach (self::getInstalled() as $installed) {
98 if (isset($installed['versions'][$packageName])) {
99 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
109 * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
127 * Returns a version constraint representing all the range(s) which are installed for a given package
130 * whether a given version of a package is installed, and not just whether it exists
137 foreach (self::getInstalled() as $installed) {
138 if (!isset($installed['versions'][$packageName])) {
143 if (isset($installed['versions'][$packageName]['pretty_version'])) {
144 $ranges[] = $installed['versions'][$packageName]['pretty_version'];
146 if (array_key_exists('aliases', $installed['versions'][$packageName])) {
147 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
149 if (array_key_exists('replaced', $installed['versions'][$packageName])) {
150 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
152 if (array_key_exists('provided', $installed['versions'][$packageName])) {
153 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
159 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
164 * @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
168 foreach (self::getInstalled() as $installed) {
169 if (!isset($installed['versions'][$packageName])) {
173 if (!isset($installed['versions'][$packageName]['version'])) {
177 return $installed['versions'][$packageName]['version'];
180 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
185 * @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
189 foreach (self::getInstalled() as $installed) {
190 if (!isset($installed['versions'][$packageName])) {
194 if (!isset($installed['versions'][$packageName]['pretty_version'])) {
198 return $installed['versions'][$packageName]['pretty_version'];
201 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
206 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
210 foreach (self::getInstalled() as $installed) {
211 if (!isset($installed['versions'][$packageName])) {
215 if (!isset($installed['versions'][$packageName]['reference'])) {
219 return $installed['versions'][$packageName]['reference'];
222 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
227 * @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.
231 foreach (self::getInstalled() as $installed) {
232 if (!isset($installed['versions'][$packageName])) {
236 return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
239 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
248 $installed = self::getInstalled();
250 return $installed[0]['root'];
254 * Returns the raw installed.php data for custom implementations
264 if (null === self::$installed) {
265 // only require the installed.php file if this file is loaded from its dumped location,
268 self::$installed = include __DIR__ . '/installed.php';
270 self::$installed = array();
274 return self::$installed;
278 * Returns the raw data of all installed.php which are currently loaded for custom implementations
293 * and wants to ensure both projects have access to their version of installed.php.
297 * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
301 * @param array[] $data A vendor/composer/installed.php data set
308 self::$installed = $data;
322 $installed = array();
327 $installed[] = self::$installedByVendor[$vendorDir];
328 } elseif (is_file($vendorDir.'/composer/installed.php')) {
329 $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
330 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
331 self::$installed = $installed[count($installed) - 1];
337 if (null === self::$installed) {
338 // only require the installed.php file if this file is loaded from its dumped location,
341 self::$installed = require __DIR__ . '/installed.php';
343 self::$installed = array();
346 $installed[] = self::$installed;
348 return $installed;