@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - const VALID_PHP_FUNCTION_NAME_PATTERN = '#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#'; |
|
| 21 | + const VALID_PHP_FUNCTION_NAME_PATTERN = '#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#'; |
|
| 22 | 22 | const CAN_NEVER_EVER_CHOOSE_THIS_AS_FUNCTION_NAME= "new"; |
| 23 | 23 | const PLACEHOLDER_FOR_INTERNALS_CLASSES_OPTIONALS_PARAMETERS ="This is internal and thus sucks we must do something ClassShortcutDesigner"; |
| 24 | 24 | private static $DIR=null; |
@@ -151,17 +151,17 @@ discard block |
||
| 151 | 151 | return include_once($file); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - private static function GetTheRightExceptionMessage($fileExists,$name,$fullQualifiedClassname){
|
|
| 155 | - if (!$fileExists) {
|
|
| 156 | - if (strtolower($name)!=='new'&&preg_match(self::VALID_PHP_FUNCTION_NAME_PATTERN, $name)) {
|
|
| 157 | - throw new \InvalidArgumentException('function '.$name.' passed as second Argument already exists.
|
|
| 154 | + private static function GetTheRightExceptionMessage($fileExists,$name,$fullQualifiedClassname){
|
|
| 155 | + if (!$fileExists) {
|
|
| 156 | + if (strtolower($name)!=='new'&&preg_match(self::VALID_PHP_FUNCTION_NAME_PATTERN, $name)) {
|
|
| 157 | + throw new \InvalidArgumentException('function '.$name.' passed as second Argument already exists.
|
|
| 158 | 158 | Can\'t create a shortcut with the same name'); |
| 159 | - } else {
|
|
| 160 | - throw new \InvalidArgumentException('function '.$fullQualifiedClassname.' already exists and An alias has not been provided as Argument 2.
|
|
| 159 | + } else {
|
|
| 160 | + throw new \InvalidArgumentException('function '.$fullQualifiedClassname.' already exists and An alias has not been provided as Argument 2.
|
|
| 161 | 161 | Can\'t create a shortcut function with this name'); |
| 162 | - } |
|
| 163 | - } |
|
| 164 | - } |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | 166 | public static function setDir($dirname) |
| 167 | 167 | {
|
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | - const VALID_PHP_FUNCTION_NAME_PATTERN = '#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#'; |
|
| 22 | - const CAN_NEVER_EVER_CHOOSE_THIS_AS_FUNCTION_NAME= "new"; |
|
| 23 | - const PLACEHOLDER_FOR_INTERNALS_CLASSES_OPTIONALS_PARAMETERS ="This is internal and thus sucks we must do something ClassShortcutDesigner"; |
|
| 21 | + const VALID_PHP_FUNCTION_NAME_PATTERN='#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#'; |
|
| 22 | + const CAN_NEVER_EVER_CHOOSE_THIS_AS_FUNCTION_NAME="new"; |
|
| 23 | + const PLACEHOLDER_FOR_INTERNALS_CLASSES_OPTIONALS_PARAMETERS="This is internal and thus sucks we must do something ClassShortcutDesigner"; |
|
| 24 | 24 | private static $DIR=null; |
| 25 | 25 | |
| 26 | 26 | public static function create($classname, $name=self::CAN_NEVER_EVER_CHOOSE_THIS_AS_FUNCTION_NAME) |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return include_once($file); |
| 71 | 71 | } |
| 72 | 72 | } else {
|
| 73 | - GetTheRightExceptionMessage($fileExists,$name,$fullQualifiedClassname); |
|
| 73 | + GetTheRightExceptionMessage($fileExists, $name, $fullQualifiedClassname); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $hasInternal.="case $count:return new $classname(".join(',', array_slice($parameters, 0, $paramsNum-$count))."); break;";
|
| 118 | 118 | $count--; |
| 119 | 119 | } |
| 120 | - $hasInternal.='default:return new '. $classname.'('.join(',', $parameters).');break;}';
|
|
| 120 | + $hasInternal.='default:return new '.$classname.'('.join(',', $parameters).');break;}';
|
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | private static function useTheRightName(&$Shortcut, $name, $fullQualifiedClassname, $signature) |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | private static function pushAndShow($file, $Shortcut) |
| 148 | 148 | {
|
| 149 | 149 | file_put_contents($file, str_replace("\t", ' ', $Shortcut));
|
| 150 | - file_put_contents($file, php_strip_whitespace($file));//just for cleanliness of the generated code |
|
| 150 | + file_put_contents($file, php_strip_whitespace($file)); //just for cleanliness of the generated code |
|
| 151 | 151 | return include_once($file); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - private static function GetTheRightExceptionMessage($fileExists,$name,$fullQualifiedClassname){
|
|
| 154 | + private static function GetTheRightExceptionMessage($fileExists, $name, $fullQualifiedClassname) {
|
|
| 155 | 155 | if (!$fileExists) {
|
| 156 | 156 | if (strtolower($name)!=='new'&&preg_match(self::VALID_PHP_FUNCTION_NAME_PATTERN, $name)) {
|
| 157 | 157 | throw new \InvalidArgumentException('function '.$name.' passed as second Argument already exists.
|