Replace defined('__NAMESPACE__') conditions with PHP version checks.
This commit is contained in:
parent
3119408761
commit
f478379ed7
|
|
@ -12,7 +12,7 @@ if ( !class_exists('Puc_v4p11_Autoloader', false) ):
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->rootDir = dirname(__FILE__) . '/';
|
$this->rootDir = dirname(__FILE__) . '/';
|
||||||
|
|
||||||
if ( defined('__NAMESPACE__') && __NAMESPACE__ ) {
|
if ( version_compare(PHP_VERSION, '5.3', '>=') && __NAMESPACE__ ) {
|
||||||
$namespaceWithSlash = __NAMESPACE__ . '\\';
|
$namespaceWithSlash = __NAMESPACE__ . '\\';
|
||||||
} else {
|
} else {
|
||||||
$namespaceWithSlash = '';
|
$namespaceWithSlash = '';
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ if ( !class_exists('Puc_v4p11_Factory', false) ):
|
||||||
*/
|
*/
|
||||||
public static function addVersion($generalClass, $versionedClass, $version) {
|
public static function addVersion($generalClass, $versionedClass, $version) {
|
||||||
if ( empty(self::$myMajorVersion) ) {
|
if ( empty(self::$myMajorVersion) ) {
|
||||||
$className = (defined('__NAMESPACE__') && __NAMESPACE__)
|
$className = (version_compare(PHP_VERSION, '5.3', '>=') && __NAMESPACE__)
|
||||||
? substr(__CLASS__, strlen(__NAMESPACE__) + 1)
|
? substr(__CLASS__, strlen(__NAMESPACE__) + 1)
|
||||||
: __CLASS__;
|
: __CLASS__;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue