Skip to content

Commit 585246e

Browse files
committed
Make PEAR_Dependency2::_getExtraString() static
Also make calls to it static (not strictly necessary) and drop an object instantiation that becomes unnecessary due to that.
1 parent 550c0a6 commit 585246e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

PEAR/Command/Package.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,6 @@ function doPackageDependencies($command, $options, $params)
872872
$deps = $info->getDependencies();
873873
$reg = &$this->config->getRegistry();
874874
if (is_array($deps)) {
875-
$d = new PEAR_Dependency2($this->config, array(), '');
876875
$data = array(
877876
'caption' => 'Dependencies for ' . $info->getPackage(),
878877
'border' => true,
@@ -929,7 +928,7 @@ function doPackageDependencies($command, $options, $params)
929928
if (isset($inf['conflicts'])) {
930929
$ver = 'conflicts';
931930
} else {
932-
$ver = $d->_getExtraString($inf);
931+
$ver = PEAR_Dependency2::_getExtraString($inf);
933932
}
934933

935934
$data['data'][] = array($req, ucfirst($deptype), $name,

PEAR/Dependency2.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function __construct(&$config, $installoptions, $package,
110110
$this->_currentPackage = $package;
111111
}
112112

113-
function _getExtraString($dep)
113+
static function _getExtraString($dep)
114114
{
115115
$extra = ' (';
116116
if (isset($dep['uri'])) {
@@ -337,7 +337,7 @@ function validateExtensionDependency($dep, $required = true)
337337
}
338338

339339
$loaded = $this->extension_loaded($dep['name']);
340-
$extra = $this->_getExtraString($dep);
340+
$extra = self::_getExtraString($dep);
341341
if (isset($dep['exclude'])) {
342342
if (!is_array($dep['exclude'])) {
343343
$dep['exclude'] = array($dep['exclude']);
@@ -486,7 +486,7 @@ function validatePhpDependency($dep)
486486
}
487487

488488
$version = $this->phpversion();
489-
$extra = $this->_getExtraString($dep);
489+
$extra = self::_getExtraString($dep);
490490
if (isset($dep['exclude'])) {
491491
if (!is_array($dep['exclude'])) {
492492
$dep['exclude'] = array($dep['exclude']);
@@ -546,7 +546,7 @@ function getPEARVersion()
546546
function validatePearinstallerDependency($dep)
547547
{
548548
$pearversion = $this->getPEARVersion();
549-
$extra = $this->_getExtraString($dep);
549+
$extra = self::_getExtraString($dep);
550550
if (isset($dep['exclude'])) {
551551
if (!is_array($dep['exclude'])) {
552552
$dep['exclude'] = array($dep['exclude']);
@@ -700,7 +700,7 @@ function _validatePackageDownload($dep, $required, $params, $depv1 = false)
700700
}
701701
}
702702

703-
$extra = $this->_getExtraString($dep);
703+
$extra = self::_getExtraString($dep);
704704
if (isset($dep['exclude']) && !is_array($dep['exclude'])) {
705705
$dep['exclude'] = array($dep['exclude']);
706706
}
@@ -1098,7 +1098,7 @@ function _validatePackageUninstall($dep, $required, $dl)
10981098
return true;
10991099
}
11001100

1101-
$extra = $this->_getExtraString($dep);
1101+
$extra = self::_getExtraString($dep);
11021102
if (isset($dep['exclude']) && !is_array($dep['exclude'])) {
11031103
$dep['exclude'] = array($dep['exclude']);
11041104
}

0 commit comments

Comments
 (0)