mirror of
https://github.com/composer/composer
synced 2025-05-10 09:02:59 +00:00
Coding standards and Cosmetics
Processing feedback given by @stof and @Seldaek.
This commit is contained in:
parent
e4a0de5df4
commit
1713acf011
4 changed files with 21 additions and 26 deletions
|
@ -12,8 +12,11 @@
|
||||||
|
|
||||||
namespace Composer\Command;
|
namespace Composer\Command;
|
||||||
|
|
||||||
|
use Composer\Composer;
|
||||||
|
use Composer\Console\Application;
|
||||||
|
use Composer\IO\IOInterface;
|
||||||
|
use Composer\IO\NullIO;
|
||||||
use Symfony\Component\Console\Command\Command as BaseCommand;
|
use Symfony\Component\Console\Command\Command as BaseCommand;
|
||||||
use Composer\Console\Application as ComposerApplication;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for Composer commands
|
* Base class for Composer commands
|
||||||
|
@ -41,43 +44,45 @@ abstract class Command extends BaseCommand
|
||||||
{
|
{
|
||||||
if (null === $this->composer) {
|
if (null === $this->composer) {
|
||||||
$application = $this->getApplication();
|
$application = $this->getApplication();
|
||||||
if ($application instanceof ComposerApplication) {
|
if ($application instanceof Application) {
|
||||||
/* @var $application ComposerApplication */
|
/* @var $application Application */
|
||||||
$this->composer = $application->getComposer();
|
$this->composer = $application->getComposer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->composer;
|
return $this->composer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Composer\Composer $composer
|
* @param \Composer\Composer $composer
|
||||||
*/
|
*/
|
||||||
public function setComposer(\Composer\Composer $composer)
|
public function setComposer(Composer $composer)
|
||||||
{
|
{
|
||||||
$this->composer = $composer;
|
$this->composer = $composer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return \Composer\IO\ConsoleIO
|
* @return \Composer\IO\IOInterface
|
||||||
*/
|
*/
|
||||||
public function getIO()
|
public function getIO()
|
||||||
{
|
{
|
||||||
if (null === $this->io) {
|
if (null === $this->io) {
|
||||||
$application = $this->getApplication();
|
$application = $this->getApplication();
|
||||||
if ($application instanceof ComposerApplication) {
|
if ($application instanceof Application) {
|
||||||
/* @var $application ComposerApplication */
|
/* @var $application Application */
|
||||||
$this->io = $application->getIO();
|
$this->io = $application->getIO();
|
||||||
} else {
|
} else {
|
||||||
$this->io = new \Composer\IO\NullIO();
|
$this->io = new NullIO();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->io;
|
return $this->io;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \Composer\IO\IOInterface $io
|
* @param \Composer\IO\IOInterface $io
|
||||||
*/
|
*/
|
||||||
public function setIO(\Composer\IO\IOInterface $io)
|
public function setIO(IOInterface $io)
|
||||||
{
|
{
|
||||||
$this->io = $io;
|
$this->io = $io;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ use Composer\Util\RemoteFilesystem;
|
||||||
class Factory
|
class Factory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @static
|
|
||||||
* @return Config
|
* @return Config
|
||||||
*/
|
*/
|
||||||
public static function createConfig()
|
public static function createConfig()
|
||||||
|
@ -66,9 +65,9 @@ class Factory
|
||||||
/**
|
/**
|
||||||
* Creates a Composer instance
|
* Creates a Composer instance
|
||||||
*
|
*
|
||||||
* @param IOInterface $io IO instance
|
* @param IOInterface $io IO instance
|
||||||
* @param array|null $localConfig either a configuration array or a filename to read from, if null it will
|
* @param array|string|null $localConfig either a configuration array or a filename to read from, if null it will
|
||||||
* read from the default filename
|
* read from the default filename
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
* @return Composer
|
* @return Composer
|
||||||
*/
|
*/
|
||||||
|
@ -169,8 +168,8 @@ class Factory
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Repository\RepositoryManager $rm
|
* @param Repository\RepositoryManager $rm
|
||||||
* @param $vendorDir
|
* @param string $vendorDir
|
||||||
*/
|
*/
|
||||||
protected function addLocalRepository(RepositoryManager $rm, $vendorDir)
|
protected function addLocalRepository(RepositoryManager $rm, $vendorDir)
|
||||||
{
|
{
|
||||||
|
@ -273,7 +272,7 @@ class Factory
|
||||||
protected function purgePackages(Repository\RepositoryManager $rm, Installer\InstallationManager $im)
|
protected function purgePackages(Repository\RepositoryManager $rm, Installer\InstallationManager $im)
|
||||||
{
|
{
|
||||||
foreach ($rm->getLocalRepositories() as $repo) {
|
foreach ($rm->getLocalRepositories() as $repo) {
|
||||||
/* @var $repo Repository\RepositoryInterface */
|
/* @var $repo Repository\WritableRepositoryInterface */
|
||||||
foreach ($repo->getPackages() as $package) {
|
foreach ($repo->getPackages() as $package) {
|
||||||
if (!$im->isPackageInstalled($repo, $package)) {
|
if (!$im->isPackageInstalled($repo, $package)) {
|
||||||
$repo->removePackage($package);
|
$repo->removePackage($package);
|
||||||
|
|
|
@ -57,13 +57,4 @@ interface RepositoryInterface extends \Countable
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getPackages();
|
function getPackages();
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes a package from the repository.
|
|
||||||
*
|
|
||||||
* @abstract
|
|
||||||
* @param \Composer\Package\PackageInterface $package
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function removePackage(PackageInterface $package);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,7 +165,7 @@ class RepositoryManager
|
||||||
/**
|
/**
|
||||||
* Returns all local repositories for the project.
|
* Returns all local repositories for the project.
|
||||||
*
|
*
|
||||||
* @return array[RepositoryInterface]
|
* @return array[WritableRepositoryInterface]
|
||||||
*/
|
*/
|
||||||
public function getLocalRepositories()
|
public function getLocalRepositories()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue