Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Fix : change self:: with static:: in call-ing static property/method() in other components ( all ) #2878

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 16 additions & 16 deletions library/Zend/Barcode/Barcode.php
Expand Up @@ -56,11 +56,11 @@ class Barcode
*/
public static function getObjectPluginManager()
{
if (!self::$objectPlugins instanceof ObjectPluginManager) {
self::$objectPlugins = new ObjectPluginManager();
if (!static::$objectPlugins instanceof ObjectPluginManager) {
static::$objectPlugins = new ObjectPluginManager();
}

return self::$objectPlugins;
return static::$objectPlugins;
}

/**
Expand All @@ -70,11 +70,11 @@ public static function getObjectPluginManager()
*/
public static function getRendererPluginManager()
{
if (!self::$rendererPlugins instanceof RendererPluginManager) {
self::$rendererPlugins = new RendererPluginManager();
if (!static::$rendererPlugins instanceof RendererPluginManager) {
static::$rendererPlugins = new RendererPluginManager();
}

return self::$rendererPlugins;
return static::$rendererPlugins;
}

/**
Expand Down Expand Up @@ -131,12 +131,12 @@ public static function factory($barcode,
}

try {
$barcode = self::makeBarcode($barcode, $barcodeConfig);
$renderer = self::makeRenderer($renderer, $rendererConfig);
$barcode = static::makeBarcode($barcode, $barcodeConfig);
$renderer = static::makeRenderer($renderer, $rendererConfig);
} catch (Exception\ExceptionInterface $e) {
if ($automaticRenderError && !($e instanceof Exception\RendererCreationException)) {
$barcode = self::makeBarcode('error', array( 'text' => $e->getMessage() ));
$renderer = self::makeRenderer($renderer, array());
$barcode = static::makeBarcode('error', array( 'text' => $e->getMessage() ));
$renderer = static::makeRenderer($renderer, array());
} else {
throw $e;
}
Expand Down Expand Up @@ -197,7 +197,7 @@ public static function makeBarcode($barcode, $barcodeConfig = array())
);
}

return self::getObjectPluginManager()->get($barcode, $barcodeConfig);
return static::getObjectPluginManager()->get($barcode, $barcodeConfig);
}

/**
Expand Down Expand Up @@ -249,7 +249,7 @@ public static function makeRenderer($renderer = 'image', $rendererConfig = array
);
}

return self::getRendererPluginManager()->get($renderer, $rendererConfig);
return static::getRendererPluginManager()->get($renderer, $rendererConfig);
}

/**
Expand All @@ -265,7 +265,7 @@ public static function render($barcode,
$barcodeConfig = array(),
$rendererConfig = array())
{
self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->render();
static::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->render();
}

/**
Expand All @@ -282,7 +282,7 @@ public static function draw($barcode,
$barcodeConfig = array(),
$rendererConfig = array())
{
return self::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->draw();
return static::factory($barcode, $renderer, $barcodeConfig, $rendererConfig)->draw();
}

/**
Expand All @@ -293,7 +293,7 @@ public static function draw($barcode,
*/
public static function setBarcodeFont($font)
{
self::$staticFont = $font;
static::$staticFont = $font;
}

/**
Expand All @@ -303,6 +303,6 @@ public static function setBarcodeFont($font)
*/
public static function getBarcodeFont()
{
return self::$staticFont;
return static::$staticFont;
}
}
4 changes: 2 additions & 2 deletions library/Zend/Barcode/Object/Code128.php
Expand Up @@ -218,8 +218,8 @@ protected function convertToBarcodeChars($string)
$char = $string[$pos];
$code = null;

if (self::_isDigit($string, $pos, 4) && $currentCharset != 'C'
|| self::_isDigit($string, $pos, 2) && $currentCharset == 'C') {
if (static::_isDigit($string, $pos, 4) && $currentCharset != 'C'
|| static::_isDigit($string, $pos, 2) && $currentCharset == 'C') {
/**
* Switch to C if the next 4 chars are numeric or stay C if the next 2
* chars are numeric
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Captcha/AbstractWord.php
Expand Up @@ -311,8 +311,8 @@ protected function generateWord()
{
$word = '';
$wordLen = $this->getWordLen();
$vowels = $this->useNumbers ? self::$VN : self::$V;
$consonants = $this->useNumbers ? self::$CN : self::$C;
$vowels = $this->useNumbers ? static::$VN : static::$V;
$consonants = $this->useNumbers ? static::$CN : static::$C;

for ($i=0; $i < $wordLen; $i = $i + 2) {
// generate word with mix of vowels and consonants
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Code/Generator/FileGenerator.php
Expand Up @@ -91,7 +91,7 @@ public static function fromReflectedFileName($filePath, $includeIfNotAlreadyIncl
include $realpath;
}

$codeGenerator = self::fromReflection(($fileReflector = new FileReflection($realpath)));
$codeGenerator = static::fromReflection(($fileReflector = new FileReflection($realpath)));

return $codeGenerator;
}
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Code/Generator/FileGeneratorRegistry.php
Expand Up @@ -40,7 +40,7 @@ public static function registerFileCodeGenerator(FileGenerator $fileCodeGenerato
// in the same DIRECTORY_SEPARATOR that realpath would use:
$fileName = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $fileName);

self::$fileCodeGenerators[$fileName] = $fileCodeGenerator;
static::$fileCodeGenerators[$fileName] = $fileCodeGenerator;

}
}
2 changes: 1 addition & 1 deletion library/Zend/Code/Generator/ParameterGenerator.php
Expand Up @@ -220,7 +220,7 @@ public function generate()
{
$output = '';

if ($this->type && !in_array($this->type, self::$simple)) {
if ($this->type && !in_array($this->type, static::$simple)) {
$output .= $this->type . ' ';
}

Expand Down
14 changes: 7 additions & 7 deletions library/Zend/Config/Factory.php
Expand Up @@ -70,11 +70,11 @@ public static function fromFile($filename, $returnConfigObject = false)
}

$config = include $filename;
} elseif (isset(self::$extensions[$extension])) {
$reader = self::$extensions[$extension];
} elseif (isset(static::$extensions[$extension])) {
$reader = static::$extensions[$extension];
if (!$reader instanceof Reader\ReaderInterface) {
$reader = self::getReaderPluginManager()->get($reader);
self::$extensions[$extension] = $reader;
$reader = static::getReaderPluginManager()->get($reader);
static::$extensions[$extension] = $reader;
}

/** @var Reader\ReaderInterface $reader */
Expand All @@ -101,7 +101,7 @@ public static function fromFiles(array $files, $returnConfigObject = false)
$config = array();

foreach ($files as $file) {
$config = ArrayUtils::merge($config, self::fromFile($file));
$config = ArrayUtils::merge($config, static::fromFile($file));
}

return ($returnConfigObject) ? new Config($config) : $config;
Expand All @@ -114,7 +114,7 @@ public static function fromFiles(array $files, $returnConfigObject = false)
*/
public static function setReaderPluginManager(ReaderPluginManager $readers)
{
self::$readers = $readers;
static::$readers = $readers;
}

/**
Expand Down Expand Up @@ -150,6 +150,6 @@ public static function registerReader($extension, $reader)
));
}

self::$extensions[$extension] = $reader;
static::$extensions[$extension] = $reader;
}
}
10 changes: 5 additions & 5 deletions library/Zend/Crypt/BlockCipher.php
Expand Up @@ -94,7 +94,7 @@ public function __construct(SymmetricInterface $cipher)
*/
public static function factory($adapter, $options = array())
{
$plugins = self::getSymmetricPluginManager();
$plugins = static::getSymmetricPluginManager();
$adapter = $plugins->get($adapter, (array) $options);
return new self($adapter);
}
Expand All @@ -106,11 +106,11 @@ public static function factory($adapter, $options = array())
*/
public static function getSymmetricPluginManager()
{
if (self::$symmetricPlugins === null) {
self::setSymmetricPluginManager(new SymmetricPluginManager());
if (static::$symmetricPlugins === null) {
static::setSymmetricPluginManager(new SymmetricPluginManager());
}

return self::$symmetricPlugins;
return static::$symmetricPlugins;
}

/**
Expand All @@ -137,7 +137,7 @@ public static function setSymmetricPluginManager($plugins)
(is_object($plugins) ? get_class($plugins) : gettype($plugins))
));
}
self::$symmetricPlugins = $plugins;
static::$symmetricPlugins = $plugins;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions library/Zend/Crypt/Hash.php
Expand Up @@ -55,7 +55,7 @@ public static function compute($hash, $data, $output = self::OUTPUT_STRING)
*/
public static function getOutputSize($hash, $output = self::OUTPUT_STRING)
{
return strlen(self::compute($hash, 'data', $output));
return strlen(static::compute($hash, 'data', $output));
}

/**
Expand All @@ -65,10 +65,10 @@ public static function getOutputSize($hash, $output = self::OUTPUT_STRING)
*/
public static function getSupportedAlgorithms()
{
if (empty(self::$supportedAlgorithms)) {
self::$supportedAlgorithms = hash_algos();
if (empty(static::$supportedAlgorithms)) {
static::$supportedAlgorithms = hash_algos();
}
return self::$supportedAlgorithms;
return static::$supportedAlgorithms;
}

/**
Expand All @@ -79,6 +79,6 @@ public static function getSupportedAlgorithms()
*/
public static function isSupported($algo)
{
return in_array($algo, self::getSupportedAlgorithms());
return in_array($algo, static::getSupportedAlgorithms());
}
}
10 changes: 5 additions & 5 deletions library/Zend/Crypt/Hmac.php
Expand Up @@ -47,7 +47,7 @@ public static function compute($key, $hash, $data, $output = self::OUTPUT_STRING
}

$hash = strtolower($hash);
if (!self::isSupported($hash)) {
if (!static::isSupported($hash)) {
throw new Exception\InvalidArgumentException(
"Hash algorithm is not supported on this PHP installation; provided '{$hash}'"
);
Expand All @@ -66,7 +66,7 @@ public static function compute($key, $hash, $data, $output = self::OUTPUT_STRING
*/
public static function getOutputSize($hash, $output = self::OUTPUT_STRING)
{
return strlen(self::compute('key', $hash, 'data', $output));
return strlen(static::compute('key', $hash, 'data', $output));
}

/**
Expand All @@ -76,10 +76,10 @@ public static function getOutputSize($hash, $output = self::OUTPUT_STRING)
*/
public static function getSupportedAlgorithms()
{
if (empty(self::$supportedAlgorithms)) {
self::$supportedAlgorithms = hash_algos();
if (empty(static::$supportedAlgorithms)) {
static::$supportedAlgorithms = hash_algos();
}
return self::$supportedAlgorithms;
return static::$supportedAlgorithms;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions library/Zend/Crypt/Key/Derivation/SaltedS2k.php
Expand Up @@ -56,12 +56,12 @@ class SaltedS2k
*/
public static function calc($hash, $password, $salt, $bytes)
{
if (!in_array($hash, array_keys(self::$supportedMhashAlgos))) {
if (!in_array($hash, array_keys(static::$supportedMhashAlgos))) {
throw new Exception\InvalidArgumentException("The hash algorihtm $hash is not supported by " . __CLASS__);
}
if (strlen($salt)<8) {
throw new Exception\InvalidArgumentException('The salt size must be at least of 8 bytes');
}
return mhash_keygen_s2k(self::$supportedMhashAlgos[$hash], $password, $salt, $bytes);
return mhash_keygen_s2k(static::$supportedMhashAlgos[$hash], $password, $salt, $bytes);
}
}
6 changes: 3 additions & 3 deletions library/Zend/Crypt/PublicKey/DiffieHellman.php
Expand Up @@ -120,7 +120,7 @@ public function __construct($prime, $generator, $privateKey = null, $privateKeyF
*/
public static function useOpensslExtension($flag = true)
{
self::$useOpenssl = (boolean) $flag;
static::$useOpenssl = (boolean) $flag;
}

/**
Expand All @@ -132,7 +132,7 @@ public static function useOpensslExtension($flag = true)
*/
public function generateKeys()
{
if (function_exists('openssl_dh_compute_key') && self::$useOpenssl !== false) {
if (function_exists('openssl_dh_compute_key') && static::$useOpenssl !== false) {
$details = array(
'p' => $this->convert($this->getPrime(), self::FORMAT_NUMBER, self::FORMAT_BINARY),
'g' => $this->convert($this->getGenerator(), self::FORMAT_NUMBER, self::FORMAT_BINARY)
Expand Down Expand Up @@ -229,7 +229,7 @@ public function getPublicKey($format = self::FORMAT_NUMBER)
public function computeSecretKey($publicKey, $publicKeyFormat = self::FORMAT_NUMBER,
$secretKeyFormat = self::FORMAT_NUMBER)
{
if (function_exists('openssl_dh_compute_key') && self::$useOpenssl !== false) {
if (function_exists('openssl_dh_compute_key') && static::$useOpenssl !== false) {
$publicKey = $this->convert($publicKey, $publicKeyFormat, self::FORMAT_BINARY);
$secretKey = openssl_dh_compute_key($publicKey, $this->opensslKeyResource);
if (false === $secretKey) {
Expand Down
10 changes: 5 additions & 5 deletions library/Zend/Crypt/Symmetric/Mcrypt.php
Expand Up @@ -143,7 +143,7 @@ public function __construct($options = array())
$this->setSalt($value);
break;
case 'padding':
$plugins = self::getPaddingPluginManager();
$plugins = static::getPaddingPluginManager();
$padding = $plugins->get($value);
$this->padding = $padding;
break;
Expand All @@ -165,7 +165,7 @@ protected function setDefaultOptions($options = array())
return;
}
if (!isset($options['padding'])) {
$plugins = self::getPaddingPluginManager();
$plugins = static::getPaddingPluginManager();
$padding = $plugins->get(self::DEFAULT_PADDING);
$this->padding = $padding;
}
Expand All @@ -178,11 +178,11 @@ protected function setDefaultOptions($options = array())
*/
public static function getPaddingPluginManager()
{
if (self::$paddingPlugins === null) {
if (static::$paddingPlugins === null) {
self::setPaddingPluginManager(new PaddingPluginManager());
}

return self::$paddingPlugins;
return static::$paddingPlugins;
}

/**
Expand Down Expand Up @@ -210,7 +210,7 @@ public static function setPaddingPluginManager($plugins)
(is_object($plugins) ? get_class($plugins) : gettype($plugins))
));
}
self::$paddingPlugins = $plugins;
static::$paddingPlugins = $plugins;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion library/Zend/Db/Adapter/Driver/Pgsql/Statement.php
Expand Up @@ -157,7 +157,7 @@ public function prepare($sql = null)
);

$this->sql = $sql;
$this->statementName = 'statement' . ++self::$statementIndex;
$this->statementName = 'statement' . ++static::$statementIndex;
$this->resource = pg_prepare($this->pgsql, $this->statementName, $sql);
}

Expand Down