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
33 private static $installed;
52 * Returns a list of all package names which are present, either by being installed, replaced or provided
60 foreach (self::getInstalled() as $installed) {
61 $packages[] = array_keys($installed['versions']);
82 foreach (self::getInstalled() as $installed) {
83 foreach ($installed['versions'] as $name => $package) {
94 * Checks whether the given package is installed
104 foreach (self::getInstalled() as $installed) {
105 if (isset($installed['versions'][$packageName])) {
106 return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
116 * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
134 * Returns a version constraint representing all the range(s) which are installed for a given package
137 * whether a given version of a package is installed, and not just whether it exists
144 foreach (self::getInstalled() as $installed) {
145 if (!isset($installed['versions'][$packageName])) {
150 if (isset($installed['versions'][$packageName]['pretty_version'])) {
151 $ranges[] = $installed['versions'][$packageName]['pretty_version'];
153 if (array_key_exists('aliases', $installed['versions'][$packageName])) {
154 $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
156 if (array_key_exists('replaced', $installed['versions'][$packageName])) {
157 $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
159 if (array_key_exists('provided', $installed['versions'][$packageName])) {
160 $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
166 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
171 * @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
175 foreach (self::getInstalled() as $installed) {
176 if (!isset($installed['versions'][$packageName])) {
180 if (!isset($installed['versions'][$packageName]['version'])) {
184 return $installed['versions'][$packageName]['version'];
187 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
192 * @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
196 foreach (self::getInstalled() as $installed) {
197 if (!isset($installed['versions'][$packageName])) {
201 if (!isset($installed['versions'][$packageName]['pretty_version'])) {
205 return $installed['versions'][$packageName]['pretty_version'];
208 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
213 * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
217 foreach (self::getInstalled() as $installed) {
218 if (!isset($installed['versions'][$packageName])) {
222 if (!isset($installed['versions'][$packageName]['reference'])) {
226 return $installed['versions'][$packageName]['reference'];
229 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
234 * @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.
238 foreach (self::getInstalled() as $installed) {
239 if (!isset($installed['versions'][$packageName])) {
243 return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
246 throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
255 $installed = self::getInstalled();
257 return $installed[0]['root'];
261 * Returns the raw installed.php data for custom implementations
271 if (null === self::$installed) {
272 // only require the installed.php file if this file is loaded from its dumped location,
275 self::$installed = include __DIR__ . '/installed.php';
277 self::$installed = array();
281 return self::$installed;
285 * Returns the raw data of all installed.php which are currently loaded for custom implementations
300 * and wants to ensure both projects have access to their version of installed.php.
304 * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
308 * @param array[] $data A vendor/composer/installed.php data set
315 self::$installed = $data;
318 // when using reload, we disable the duplicate protection to ensure that self::$installed data is
319 // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
321 // all installed packages for example
335 $installed = array();
343 $installed[] = self::$installedByVendor[$vendorDir];
344 } elseif (is_file($vendorDir.'/composer/installed.php')) {
346 $required = require $vendorDir.'/composer/installed.php';
348 $installed[] = $required;
349 if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
350 self::$installed = $required;
360 if (null === self::$installed) {
361 // only require the installed.php file if this file is loaded from its dumped location,
365 $required = require __DIR__ . '/installed.php';
366 self::$installed = $required;
368 self::$installed = array();
372 if (self::$installed !== array() && !$copiedLocalDir) {
373 $installed[] = self::$installed;
376 return $installed;