@@ -32,56 +32,56 @@ |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - private static function _init($classname, $name){ |
|
| 36 | - return [ |
|
| 37 | - 'reflectionClass'=>$tmp=new \reflectionClass($classname), |
|
| 38 | - 'classname'=>$tmp->getName(), |
|
| 39 | - 'fullQualifiedClassname'=>str_replace('\\', '_', $classname), |
|
| 40 | - ]; |
|
| 41 | - } |
|
| 35 | + private static function _init($classname, $name){ |
|
| 36 | + return [ |
|
| 37 | + 'reflectionClass'=>$tmp=new \reflectionClass($classname), |
|
| 38 | + 'classname'=>$tmp->getName(), |
|
| 39 | + 'fullQualifiedClassname'=>str_replace('\\', '_', $classname), |
|
| 40 | + ]; |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - private static function forwardInit($name,$Dir,\reflectionClass $reflectionClass){ |
|
| 44 | - self::createDir($Dir); |
|
| 45 | - return [ |
|
| 46 | - 'private_scope'=>false, |
|
| 47 | - 'name'=>trim($name), |
|
| 48 | - 'reflectionMethod'=>$reflectionClass->getConstructor(), |
|
| 49 | - 'notInstantiable'=>false, |
|
| 50 | - ]; |
|
| 51 | - } |
|
| 43 | + private static function forwardInit($name,$Dir,\reflectionClass $reflectionClass){ |
|
| 44 | + self::createDir($Dir); |
|
| 45 | + return [ |
|
| 46 | + 'private_scope'=>false, |
|
| 47 | + 'name'=>trim($name), |
|
| 48 | + 'reflectionMethod'=>$reflectionClass->getConstructor(), |
|
| 49 | + 'notInstantiable'=>false, |
|
| 50 | + ]; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | - private static function _create($classname, $name){ |
|
| 54 | - extract(self::_init($classname, $name)); |
|
| 55 | - self::getTheRightDir($file, $Dir, $fullQualifiedClassname); |
|
| 56 | - $fileExists=file_exists($file); |
|
| 57 | - if (!function_exists($classname)&&!function_exists($name)) { |
|
| 58 | - if ($fileExists) { |
|
| 59 | - return include_once($file); |
|
| 60 | - } |
|
| 61 | - extract(self::forwardInit($name,$Dir,$reflectionClass)); |
|
| 62 | - if (is_null($reflectionMethod)||$notInstantiable=!$reflectionClass->isInstantiable()) { |
|
| 63 | - self::HandleNotInstantiableAndHasNoConstructor($Shortcut, $fullQualifiedClassname, $name, $notInstantiable, $classname); |
|
| 64 | - if ($Shortcut) { |
|
| 65 | - return self::pushAndShow($file, $Shortcut); |
|
| 66 | - } |
|
| 67 | - $private_scope=true; |
|
| 68 | - } |
|
| 53 | + private static function _create($classname, $name){ |
|
| 54 | + extract(self::_init($classname, $name)); |
|
| 55 | + self::getTheRightDir($file, $Dir, $fullQualifiedClassname); |
|
| 56 | + $fileExists=file_exists($file); |
|
| 57 | + if (!function_exists($classname)&&!function_exists($name)) { |
|
| 58 | + if ($fileExists) { |
|
| 59 | + return include_once($file); |
|
| 60 | + } |
|
| 61 | + extract(self::forwardInit($name,$Dir,$reflectionClass)); |
|
| 62 | + if (is_null($reflectionMethod)||$notInstantiable=!$reflectionClass->isInstantiable()) { |
|
| 63 | + self::HandleNotInstantiableAndHasNoConstructor($Shortcut, $fullQualifiedClassname, $name, $notInstantiable, $classname); |
|
| 64 | + if ($Shortcut) { |
|
| 65 | + return self::pushAndShow($file, $Shortcut); |
|
| 66 | + } |
|
| 67 | + $private_scope=true; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - self::getSignature($reflectionMethod, $signature, $parameters, $paramsNum, $count); |
|
| 70 | + self::getSignature($reflectionMethod, $signature, $parameters, $paramsNum, $count); |
|
| 71 | 71 | |
| 72 | - $hasInternal=''; |
|
| 73 | - if ($count) { |
|
| 74 | - self::BuildTheSwitch($hasInternal, $count, $paramsNum, $parameters, $classname); |
|
| 75 | - } |
|
| 76 | - self::useTheRightNameAndScope($Shortcut, $name, $fullQualifiedClassname, $signature, $private_scope, $classname); |
|
| 72 | + $hasInternal=''; |
|
| 73 | + if ($count) { |
|
| 74 | + self::BuildTheSwitch($hasInternal, $count, $paramsNum, $parameters, $classname); |
|
| 75 | + } |
|
| 76 | + self::useTheRightNameAndScope($Shortcut, $name, $fullQualifiedClassname, $signature, $private_scope, $classname); |
|
| 77 | 77 | |
| 78 | - self::handleInternals($Shortcut, $hasInternal, $parameters, $signature, $classname); |
|
| 78 | + self::handleInternals($Shortcut, $hasInternal, $parameters, $signature, $classname); |
|
| 79 | 79 | |
| 80 | - return self::pushAndShow($file, $Shortcut); |
|
| 81 | - } else { |
|
| 82 | - self::GetTheRightExceptionMessage($fileExists, $name, $fullQualifiedClassname); |
|
| 83 | - } |
|
| 84 | - } |
|
| 80 | + return self::pushAndShow($file, $Shortcut); |
|
| 81 | + } else { |
|
| 82 | + self::GetTheRightExceptionMessage($fileExists, $name, $fullQualifiedClassname); |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | 86 | private static function getSignature(\ReflectionMethod $method, &$signature, &$parameters, &$paramsNum, &$count) |
| 87 | 87 | { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | public static function SetShortcutForAll($bool) |
| 25 | 25 | { |
| 26 | - self::$SHORTCUT_FOR_ALL=(bool)$bool; |
|
| 26 | + self::$SHORTCUT_FOR_ALL=(bool) $bool; |
|
| 27 | 27 | } |
| 28 | 28 | public static function create($classname, $name=self::CAN_NEVER_EVER_CHOOSE_THIS_AS_FUNCTION_NAME) |
| 29 | 29 | { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - private static function _init($classname, $name){ |
|
| 35 | + private static function _init($classname, $name) { |
|
| 36 | 36 | return [ |
| 37 | 37 | 'reflectionClass'=>$tmp=new \reflectionClass($classname), |
| 38 | 38 | 'classname'=>$tmp->getName(), |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | ]; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - private static function forwardInit($name,$Dir,\reflectionClass $reflectionClass){ |
|
| 43 | + private static function forwardInit($name, $Dir, \reflectionClass $reflectionClass) { |
|
| 44 | 44 | self::createDir($Dir); |
| 45 | 45 | return [ |
| 46 | 46 | 'private_scope'=>false, |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | ]; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - private static function _create($classname, $name){ |
|
| 53 | + private static function _create($classname, $name) { |
|
| 54 | 54 | extract(self::_init($classname, $name)); |
| 55 | 55 | self::getTheRightDir($file, $Dir, $fullQualifiedClassname); |
| 56 | 56 | $fileExists=file_exists($file); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | if ($fileExists) { |
| 59 | 59 | return include_once($file); |
| 60 | 60 | } |
| 61 | - extract(self::forwardInit($name,$Dir,$reflectionClass)); |
|
| 61 | + extract(self::forwardInit($name, $Dir, $reflectionClass)); |
|
| 62 | 62 | if (is_null($reflectionMethod)||$notInstantiable=!$reflectionClass->isInstantiable()) { |
| 63 | 63 | self::HandleNotInstantiableAndHasNoConstructor($Shortcut, $fullQualifiedClassname, $name, $notInstantiable, $classname); |
| 64 | 64 | if ($Shortcut) { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | private static function getParameterDeclaration(\reflectionParameter $param, &$tmp, &$count, $method) |
| 105 | 105 | { |
| 106 | - $tmp=$param->isPassedByReference()?'&$'.$param->getName():'$'.$param->getName(); |
|
| 106 | + $tmp=$param->isPassedByReference() ? '&$'.$param->getName() : '$'.$param->getName(); |
|
| 107 | 107 | if ($param->isOptional()) { |
| 108 | 108 | $count++; |
| 109 | 109 | if ($method->isInternal()) { |