Removed unused variables, properties and parameters of private functions

main
Simon Berger 4 years ago
parent 002fd39bc6
commit a6475a7118

@ -609,7 +609,7 @@ EOF;
$extensionProviders = array();
foreach ($packageMap as $item) {
list($package, $installPath) = $item;
$package = $item[0];
foreach (array_merge($package->getReplaces(), $package->getProvides()) as $link) {
if (preg_match('{^ext-(.+)$}iD', $link->getTarget(), $match)) {
$extensionProviders[$match[1]][] = $link->getConstraint() ?: new MatchAllConstraint();
@ -618,7 +618,7 @@ EOF;
}
foreach ($packageMap as $item) {
list($package, $installPath) = $item;
$package = $item[0];
foreach ($package->getRequires() as $link) {
if (in_array($link->getTarget(), $ignorePlatformReqs, true)) {
continue;

@ -153,7 +153,6 @@ EOT
protected function printTable(OutputInterface $output, $results)
{
$table = array();
$rows = array();
foreach ($results as $result) {
/**

@ -434,7 +434,7 @@ EOT
));
} else {
// check that the specified version/constraint exists before we proceed
list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $platformRepo, $preferredStability, $checkProvidedVersions ? $requirement['version'] : null, 'dev', $fixed);
list($name) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $platformRepo, $preferredStability, $checkProvidedVersions ? $requirement['version'] : null, 'dev', $fixed);
// replace package name from packagist.org
$requirement['name'] = $name;
@ -558,7 +558,7 @@ EOT
);
if (false === $constraint) {
list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $platformRepo, $preferredStability);
list(, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $platformRepo, $preferredStability);
$io->writeError(sprintf(
'Using version <info>%s</info> for <info>%s</info>',

@ -1115,7 +1115,7 @@ EOT
array $packagesInTree
) {
$children = array();
list($package, $versions) = $this->getPackage(
list($package) = $this->getPackage(
$installedRepo,
$remoteRepos,
$name,

@ -73,7 +73,7 @@ EOT
// Dispatch pre-status-command
$composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
$exitCode = $this->doExecute($input, $output);
$exitCode = $this->doExecute($input);
// Dispatch post-status-command
$composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
@ -83,10 +83,9 @@ EOT
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
private function doExecute(InputInterface $input, OutputInterface $output)
private function doExecute(InputInterface $input)
{
// init repos
$composer = $this->getComposer();

@ -322,7 +322,6 @@ abstract class Rule
*/
protected function formatPackagesUnique($pool, array $packages, $isVerbose)
{
$prepared = array();
foreach ($packages as $index => $package) {
if (!\is_object($package)) {
$packages[$index] = $pool->literalToPackage($package);

@ -645,9 +645,6 @@ class Solver
* with step 1
*/
$decisionQueue = array();
$decisionSupplementQueue = array();
$level = 1;
$systemLevel = $level + 1;

@ -62,7 +62,6 @@ class FossilDownloader extends VcsDownloader
// Ensure we are allowed to use this URL by config
$this->config->prohibitUrlByConfig($url, $this->io);
$url = ProcessExecutor::escape($url);
$ref = ProcessExecutor::escape($target->getSourceReference());
$this->io->writeError(" Updating to ".$target->getSourceReference());

@ -142,7 +142,6 @@ class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
$cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
$ref = $target->getSourceReference();
$flag = Platform::isWindows() ? '/D ' : '';
if (!empty($this->cachedPackages[$target->getId()][$ref])) {
$msg = "Checking out ".$this->getShortHash($ref).' from cache';

@ -27,8 +27,6 @@ use React\Promise\PromiseInterface;
*/
class PluginInstaller extends LibraryInstaller
{
private $installationManager;
/**
* Initializes Plugin installer.
*
@ -38,7 +36,6 @@ class PluginInstaller extends LibraryInstaller
public function __construct(IOInterface $io, Composer $composer, Filesystem $fs = null, BinaryInstaller $binaryInstaller = null)
{
parent::__construct($io, $composer, 'composer-plugin', $fs, $binaryInstaller);
$this->installationManager = $composer->getInstallationManager();
}
/**

@ -47,11 +47,6 @@ class RootPackageLoader extends ArrayLoader
*/
private $versionGuesser;
/**
* @var IOInterface
*/
private $io;
public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null)
{
parent::__construct($parser);
@ -59,7 +54,6 @@ class RootPackageLoader extends ArrayLoader
$this->manager = $manager;
$this->config = $config;
$this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor($io), $this->versionParser);
$this->io = $io;
}
/**

@ -79,7 +79,7 @@ class VersionGuesser
return $this->postprocess($versionData);
}
$versionData = $this->guessFossilVersion($packageConfig, $path);
$versionData = $this->guessFossilVersion($path);
if (null !== $versionData && null !== $versionData['version']) {
return $this->postprocess($versionData);
}
@ -288,7 +288,7 @@ class VersionGuesser
return !preg_match('{^(' . $nonFeatureBranches . '|master|main|latest|next|current|support|tip|trunk|default|develop|\d+\..+)$}', $branchName, $match);
}
private function guessFossilVersion(array $packageConfig, $path)
private function guessFossilVersion($path)
{
$version = null;
$prettyVersion = null;

@ -165,7 +165,7 @@ class FossilDriver extends VcsDriver
public function getChangeDate($identifier)
{
$this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
list($ckout, $date, $message) = explode(' ', trim($output), 3);
list(,$date) = explode(' ', trim($output), 2);
return new \DateTime($date, new \DateTimeZone('UTC'));
}
@ -196,7 +196,6 @@ class FossilDriver extends VcsDriver
{
if (null === $this->branches) {
$branches = array();
$bookmarks = array();
$this->process->execute('fossil branch list', $output, $this->checkoutDir);
foreach ($this->process->splitLines($output) as $branch) {

@ -140,7 +140,6 @@ class PerforceDriver extends VcsDriver
public function hasComposerFile($identifier)
{
$composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
$composerInfoIdentifier = $identifier;
return !empty($composerInfo);
}

@ -79,7 +79,6 @@ class AuthHelper
public function promptAuthIfNeeded($url, $origin, $statusCode, $reason = null, $headers = array())
{
$storeAuth = false;
$retry = false;
if (in_array($origin, $this->config->get('github-domains'), true)) {
$gitHubUtil = new GitHub($this->io, $this->config, null);
@ -181,9 +180,7 @@ class AuthHelper
$storeAuth = $this->config->get('store-auths');
}
$retry = true;
return array('retry' => $retry, 'storeAuth' => $storeAuth);
return array('retry' => true, 'storeAuth' => $storeAuth);
}
/**

@ -93,7 +93,7 @@ class Bitbucket
* @param string $originUrl
* @return bool
*/
private function requestAccessToken($originUrl)
private function requestAccessToken()
{
try {
$response = $this->httpDownloader->get(self::OAUTH2_ACCESS_TOKEN_URL, array(
@ -166,7 +166,7 @@ class Bitbucket
$this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
if (!$this->requestAccessToken($originUrl)) {
if (!$this->requestAccessToken()) {
return false;
}
@ -196,7 +196,7 @@ class Bitbucket
}
$this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
if (!$this->requestAccessToken($originUrl)) {
if (!$this->requestAccessToken()) {
return '';
}

@ -286,12 +286,12 @@ class Git
public function fetchRefOrSyncMirror($url, $dir, $ref)
{
if ($this->checkRefIsInMirror($url, $dir, $ref)) {
if ($this->checkRefIsInMirror($dir, $ref)) {
return true;
}
if ($this->syncMirror($url, $dir)) {
return $this->checkRefIsInMirror($url, $dir, $ref);
return $this->checkRefIsInMirror($dir, $ref);
}
return false;
@ -307,7 +307,7 @@ class Git
return '';
}
private function checkRefIsInMirror($url, $dir, $ref)
private function checkRefIsInMirror($dir, $ref)
{
if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
$escapedRef = ProcessExecutor::escape($ref.'^{commit}');

@ -214,7 +214,6 @@ class CurlDownloader
$this->checkCurlResult(curl_multi_add_handle($this->multiHandle, $curlHandle));
// TODO progress
//$params['notification'](STREAM_NOTIFY_RESOLVE, STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0, false);
return (int) $curlHandle;
}
@ -271,7 +270,6 @@ class CurlDownloader
$response = null;
try {
// TODO progress
//$this->onProgress($curlHandle, $job['callback'], $progress, $job['progress']);
if (CURLE_OK !== $errno || $error) {
throw new TransportException($error);
}
@ -363,7 +361,6 @@ class CurlDownloader
$progress = array_diff_key(curl_getinfo($curlHandle), self::$timeInfo);
if ($this->jobs[$i]['progress'] !== $progress) {
$previousProgress = $this->jobs[$i]['progress'];
$this->jobs[$i]['progress'] = $progress;
if (isset($this->jobs[$i]['options']['max_file_size'])) {
@ -378,8 +375,7 @@ class CurlDownloader
}
}
// TODO
//$this->onProgress($curlHandle, $this->jobs[$i]['callback'], $progress, $previousProgress);
// TODO progress
}
}
}

@ -39,8 +39,6 @@ class HttpDownloader
private $options = array();
private $runningJobs = 0;
private $maxJobs = 10;
private $lastProgress;
private $disableTls = false;
private $curl;
private $rfs;
private $idGen = 0;
@ -63,8 +61,6 @@ class HttpDownloader
// The cafile option can be set via config.json
if ($disableTls === false) {
$this->options = StreamContextFactory::getTlsDefaults($options, $io);
} else {
$this->disableTls = true;
}
// handle the other externally set options normally.
@ -81,7 +77,7 @@ class HttpDownloader
public function get($url, $options = array())
{
list($job, $promise) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => false), true);
list($job) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => false), true);
$this->wait($job['id']);
return $this->getResponse($job['id']);
@ -89,14 +85,14 @@ class HttpDownloader
public function add($url, $options = array())
{
list($job, $promise) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => false));
list(, $promise) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => false));
return $promise;
}
public function copy($url, $to, $options = array())
{
list($job, $promise) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => $to), true);
list($job) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => $to), true);
$this->wait($job['id']);
return $this->getResponse($job['id']);
@ -104,7 +100,7 @@ class HttpDownloader
public function addCopy($url, $to, $options = array())
{
list($job, $promise) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => $to));
list(, $promise) = $this->addJob(array('url' => $url, 'options' => $options, 'copyTo' => $to));
return $promise;
}
@ -167,7 +163,7 @@ class HttpDownloader
$job['status'] = HttpDownloader::STATUS_STARTED;
if ($job['request']['copyTo']) {
$result = $rfs->copy($job['origin'], $url, $job['request']['copyTo'], false /* TODO progress */, $options);
$rfs->copy($job['origin'], $url, $job['request']['copyTo'], false /* TODO progress */, $options);
$headers = $rfs->getLastHeaders();
$response = new Http\Response($job['request'], $rfs->findStatusCode($headers), $headers, $job['request']['copyTo'].'~');
@ -184,7 +180,6 @@ class HttpDownloader
}
$downloader = $this;
$io = $this->io;
$curl = $this->curl;
$canceler = function () use (&$job, $curl) {

@ -389,7 +389,6 @@ class Perforce
} else {
$command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
$exitCode = $this->executeCommand($command);
$result = trim($this->commandResult);
if ($exitCode) {
throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
}

@ -155,7 +155,6 @@ class ProcessExecutor
};
$self = $this;
$io = $this->io;
$canceler = function () use (&$job) {
if ($job['status'] === ProcessExecutor::STATUS_QUEUED) {

Loading…
Cancel
Save