OXIESEC PANEL
- Current Dir:
/
/
usr
/
share
/
php
/
Composer
/
Installer
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
07/20/2024 06:32:22 AM
rwxr-xr-x
📄
BinaryInstaller.php
6.8 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
BinaryPresenceInterface.php
731 bytes
01/31/2018 03:28:18 PM
rw-r--r--
📄
InstallationManager.php
10.51 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
InstallerEvent.php
3.14 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
InstallerEvents.php
1.01 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
InstallerInterface.php
2.4 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
LibraryInstaller.php
7.16 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
MetapackageInstaller.php
1.87 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
NoopInstaller.php
2.11 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
PackageEvent.php
1.83 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
PackageEvents.php
1.97 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
PearBinaryInstaller.php
4.81 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
PearInstaller.php
2.8 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
PluginInstaller.php
2.55 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
ProjectInstaller.php
2.55 KB
01/31/2018 03:28:18 PM
rw-r--r--
📄
SuggestedPackagesReporter.php
3.9 KB
01/31/2018 03:28:18 PM
rw-r--r--
Editing: SuggestedPackagesReporter.php
Close
<?php /* * This file is part of Composer. * * (c) Nils Adermann <naderman@naderman.de> * Jordi Boggiano <j.boggiano@seld.be> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Composer\Installer; use Composer\IO\IOInterface; use Composer\Package\PackageInterface; use Composer\Repository\RepositoryInterface; use Symfony\Component\Console\Formatter\OutputFormatter; /** * Add suggested packages from different places to output them in the end. * * @author Haralan Dobrev <hkdobrev@gmail.com> */ class SuggestedPackagesReporter { /** * @var array */ protected $suggestedPackages = array(); /** * @var IOInterface */ private $io; public function __construct(IOInterface $io) { $this->io = $io; } /** * @return array Suggested packages with source, target and reason keys. */ public function getPackages() { return $this->suggestedPackages; } /** * Add suggested packages to be listed after install * * Could be used to add suggested packages both from the installer * or from CreateProjectCommand. * * @param string $source Source package which made the suggestion * @param string $target Target package to be suggested * @param string $reason Reason the target package to be suggested * @return SuggestedPackagesReporter */ public function addPackage($source, $target, $reason) { $this->suggestedPackages[] = array( 'source' => $source, 'target' => $target, 'reason' => $reason, ); return $this; } /** * Add all suggestions from a package. * * @param PackageInterface $package * @return SuggestedPackagesReporter */ public function addSuggestionsFromPackage(PackageInterface $package) { $source = $package->getPrettyName(); foreach ($package->getSuggests() as $target => $reason) { $this->addPackage( $source, $target, $reason ); } return $this; } /** * Output suggested packages. * Do not list the ones already installed if installed repository provided. * * @param RepositoryInterface $installedRepo Installed packages * @return SuggestedPackagesReporter */ public function output(RepositoryInterface $installedRepo = null) { $suggestedPackages = $this->getPackages(); $installedPackages = array(); if (null !== $installedRepo && ! empty($suggestedPackages)) { foreach ($installedRepo->getPackages() as $package) { $installedPackages = array_merge( $installedPackages, $package->getNames() ); } } foreach ($suggestedPackages as $suggestion) { if (in_array($suggestion['target'], $installedPackages)) { continue; } $this->io->writeError(sprintf( '%s suggests installing %s (%s)', $suggestion['source'], $this->escapeOutput($suggestion['target']), $this->escapeOutput($suggestion['reason']) )); } return $this; } /** * @param string $string * @return string */ private function escapeOutput($string) { return OutputFormatter::escape( $this->removeControlCharacters($string) ); } /** * @param string $string * @return string */ private function removeControlCharacters($string) { return preg_replace( '/[[:cntrl:]]/', '', str_replace("\n", ' ', $string) ); } }