Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/globals.php
Show First 20 Lines • Show All 991 Lines • ▼ Show 20 Line(s) | |||||
if ( !is_null($message) ) { | if ( !is_null($message) ) { | ||||
@trigger_error(sprintf($msg . '! %3$s', $method, $version, $message), E_USER_DEPRECATED); | @trigger_error(sprintf($msg . '! %3$s', $method, $version, $message), E_USER_DEPRECATED); | ||||
} | } | ||||
else { | else { | ||||
@trigger_error(sprintf($msg . ' with no alternative available.', $method, $version), E_USER_DEPRECATED); | @trigger_error(sprintf($msg . ' with no alternative available.', $method, $version), E_USER_DEPRECATED); | ||||
} | } | ||||
} | } | ||||
/** | |||||
* Parse ini size | |||||
* | |||||
* @param string $size Size. | |||||
* | |||||
* @return integer | |||||
*/ | |||||
public static function parseIniSize($size) | |||||
{ | |||||
$result = (int)$size; | |||||
$size = strtolower($size); | |||||
if ( strpos($size, 'k') ) { | |||||
return $result * 1024; | |||||
} | |||||
if ( strpos($size, 'm') ) { | |||||
return $result * 1024 * 1024; | |||||
} | |||||
if ( strpos($size, 'g') ) { | |||||
return $result * 1024 * 1024 * 1024; | |||||
} | |||||
return $result; | |||||
} | |||||
alex: Considering that method is called several times (3 at max) during each page load you though… | |||||
} | } | ||||
/** | /** | ||||
* Returns array value if key exists | * Returns array value if key exists | ||||
* Accepts infinite number of parameters | * Accepts infinite number of parameters | ||||
* | * | ||||
* @param Array $array searchable array | * @param Array $array searchable array | ||||
* @param int $key array key | * @param int $key array key | ||||
▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines |
Considering that method is called several times (3 at max) during each page load you though refactor it to make it maximally fast (maybe examples exist on the internet).
Several ideas to consider, but feel free to do what you think is best: