|
@@ -15,9 +15,9 @@ discard block |
|
|
block discarded – undo |
|
15
|
15
|
|
|
16
|
16
|
class Shortcut
|
|
17
|
17
|
{
|
|
18
|
|
- const VALID_PHP_FUNCTION_NAME_PATTERN = '#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#';
|
|
19
|
|
- const CAN_NEVER_EVER_CHOOSE_THIS_AS_FUNCTION_NAME= "new";
|
|
20
|
|
- const PLACEHOLDER_FOR_INTERNALS_CLASSES_OPTIONALS_PARAMETERS ="This is internal and thus sucks we must do something ClassShortcutDesigner";
|
|
|
18
|
+ const VALID_PHP_FUNCTION_NAME_PATTERN='#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$#';
|
|
|
19
|
+ const CAN_NEVER_EVER_CHOOSE_THIS_AS_FUNCTION_NAME="new";
|
|
|
20
|
+ const PLACEHOLDER_FOR_INTERNALS_CLASSES_OPTIONALS_PARAMETERS="This is internal and thus sucks we must do something ClassShortcutDesigner";
|
|
21
|
21
|
private static $DIR=null;
|
|
22
|
22
|
|
|
23
|
23
|
public static function create($classname, $name=self::CAN_NEVER_EVER_CHOOSE_THIS_AS_FUNCTION_NAME)
|
|
@@ -56,7 +56,7 @@ discard block |
|
|
block discarded – undo |
|
56
|
56
|
$Shortcut.="return new $classname();
|
|
57
|
57
|
}";
|
|
58
|
58
|
file_put_contents($file, str_replace("\t", ' ', $Shortcut));
|
|
59
|
|
- file_put_contents($file, php_strip_whitespace($file));//just for cleanliness of the generated code
|
|
|
59
|
+ file_put_contents($file, php_strip_whitespace($file)); //just for cleanliness of the generated code
|
|
60
|
60
|
return include_once($file);
|
|
61
|
61
|
}
|
|
62
|
62
|
}
|
|
@@ -69,7 +69,7 @@ discard block |
|
|
block discarded – undo |
|
69
|
69
|
$hasInternal.="case $count:return new $classname(".join(',', array_slice($parameters, 0, $paramsNum-$count))."); break;";
|
|
70
|
70
|
$count--;
|
|
71
|
71
|
}
|
|
72
|
|
- $hasInternal.='default:return new '. $classname.'('.join(',', $parameters).');break;}';
|
|
|
72
|
+ $hasInternal.='default:return new '.$classname.'('.join(',', $parameters).');break;}';
|
|
73
|
73
|
}
|
|
74
|
74
|
if (strtolower($name)!=='new'&&preg_match(self::VALID_PHP_FUNCTION_NAME_PATTERN, $name)) {
|
|
75
|
75
|
$Shortcut="<?php
|
|
@@ -89,7 +89,7 @@ discard block |
|
|
block discarded – undo |
|
89
|
89
|
}
|
|
90
|
90
|
|
|
91
|
91
|
file_put_contents($file, str_replace("\t", ' ', $Shortcut));
|
|
92
|
|
- file_put_contents($file, php_strip_whitespace($file));//just for cleanliness of the generated code
|
|
|
92
|
+ file_put_contents($file, php_strip_whitespace($file)); //just for cleanliness of the generated code
|
|
93
|
93
|
return include_once($file);
|
|
94
|
94
|
} else {
|
|
95
|
95
|
return include_once($file);
|