@@ -4,17 +4,17 @@ |
||
4 | 4 | |
5 | 5 | if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
6 | 6 | if (preg_match('/vendor/', SOURCE_DIR)) { |
7 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
8 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
9 | -} else { |
|
10 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
11 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
7 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'); |
|
8 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'src'); |
|
9 | +}else { |
|
10 | + if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR.DIRECTORY_SEPARATOR.'..'); |
|
11 | + if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'modules'); |
|
12 | 12 | } |
13 | -if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
14 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
15 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
16 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
17 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
13 | +if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'vendor'); |
|
14 | +if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs'); |
|
15 | +if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'cache'); |
|
16 | +if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'config'); |
|
17 | +if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'html'); |
|
18 | 18 | |
19 | 19 | //Cargamos en memoria la función de desarrollo PRE |
20 | 20 | if (!function_exists('pre')) { |
@@ -1,20 +1,42 @@ |
||
1 | 1 | <?php |
2 | -if (defined('PSFS_BOOTSTRAP_LOADED')) return; |
|
2 | +if (defined('PSFS_BOOTSTRAP_LOADED')) { |
|
3 | + return; |
|
4 | +} |
|
3 | 5 | use Symfony\Component\Finder\Finder; |
4 | 6 | |
5 | -if (!defined('SOURCE_DIR')) define('SOURCE_DIR', __DIR__); |
|
7 | +if (!defined('SOURCE_DIR')) { |
|
8 | + define('SOURCE_DIR', __DIR__); |
|
9 | +} |
|
6 | 10 | if (preg_match('/vendor/', SOURCE_DIR)) { |
7 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
8 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
9 | -} else { |
|
10 | - if (!defined('BASE_DIR')) define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
11 | - if (!defined('CORE_DIR')) define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
12 | -} |
|
13 | -if (!defined('VENDOR_DIR')) define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
14 | -if (!defined('LOG_DIR')) define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
15 | -if (!defined('CACHE_DIR')) define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
16 | -if (!defined('CONFIG_DIR')) define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
17 | -if (!defined('WEB_DIR')) define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
11 | + if (!defined('BASE_DIR')) { |
|
12 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); |
|
13 | + } |
|
14 | + if (!defined('CORE_DIR')) { |
|
15 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'src'); |
|
16 | + } |
|
17 | + } else { |
|
18 | + if (!defined('BASE_DIR')) { |
|
19 | + define('BASE_DIR', SOURCE_DIR . DIRECTORY_SEPARATOR . '..'); |
|
20 | + } |
|
21 | + if (!defined('CORE_DIR')) { |
|
22 | + define('CORE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'modules'); |
|
23 | + } |
|
24 | + } |
|
25 | +if (!defined('VENDOR_DIR')) { |
|
26 | + define('VENDOR_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'vendor'); |
|
27 | +} |
|
28 | +if (!defined('LOG_DIR')) { |
|
29 | + define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs'); |
|
30 | +} |
|
31 | +if (!defined('CACHE_DIR')) { |
|
32 | + define('CACHE_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'cache'); |
|
33 | +} |
|
34 | +if (!defined('CONFIG_DIR')) { |
|
35 | + define('CONFIG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'config'); |
|
36 | +} |
|
37 | +if (!defined('WEB_DIR')) { |
|
38 | + define('WEB_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'html'); |
|
39 | +} |
|
18 | 40 | |
19 | 41 | //Cargamos en memoria la función de desarrollo PRE |
20 | 42 | if (!function_exists('pre')) { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | public static function sortByLabel(array $elementA, array $elementB) { |
16 | 16 | $labelA = array_key_exists('label', $elementA) ? $elementA['label'] : ''; |
17 | 17 | $labelB = array_key_exists('label', $elementB) ? $elementB['label'] : ''; |
18 | - if($labelA == $labelB) { |
|
18 | + if ($labelA == $labelB) { |
|
19 | 19 | return 0; |
20 | 20 | } |
21 | 21 | return $labelA < $labelB ? -1 : 1; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | if (preg_match('/^\/admin(\/|$)/', $routePattern)) { |
34 | 34 | if (preg_match('/^\\\?PSFS/', $params["class"])) { |
35 | 35 | $profile = "superadmin"; |
36 | - } else { |
|
36 | + }else { |
|
37 | 37 | $profile = "admin"; |
38 | 38 | } |
39 | 39 | if (!empty($params["default"]) && preg_match('/(GET|ALL)/i', $httpMethod)) { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public static function extractVariables(\ReflectionClass $reflector) { |
17 | 17 | $variables = []; |
18 | - foreach($reflector->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) { |
|
18 | + foreach ($reflector->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) { |
|
19 | 19 | $instanceType = self::extractVarType($property->getDocComment()); |
20 | 20 | if (null !== $instanceType) { |
21 | 21 | $variables[$property->getName()] = $instanceType; |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public static function constructInyectableInstance($variable, $singleton, $classNameSpace, $calledClass) |
71 | 71 | { |
72 | - Logger::log('Create inyectable instance for ' . $classNameSpace); |
|
72 | + Logger::log('Create inyectable instance for '.$classNameSpace); |
|
73 | 73 | $reflector = new \ReflectionClass($calledClass); |
74 | 74 | $property = $reflector->getProperty($variable); |
75 | 75 | $varInstanceType = (null === $classNameSpace) ? InjectorHelper::extractVarType($property->getDocComment()) : $classNameSpace; |
76 | 76 | if (true === $singleton && method_exists($varInstanceType, "getInstance")) { |
77 | 77 | $instance = $varInstanceType::getInstance(); |
78 | - } else { |
|
78 | + }else { |
|
79 | 79 | $instance = new $varInstanceType(); |
80 | 80 | } |
81 | 81 | return $instance; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | public static function getClassProperties($class) |
90 | 90 | { |
91 | 91 | $properties = []; |
92 | - Logger::log('Extracting annotations properties from class ' . $class); |
|
92 | + Logger::log('Extracting annotations properties from class '.$class); |
|
93 | 93 | $selfReflector = new \ReflectionClass($class); |
94 | 94 | if (false !== $selfReflector->getParentClass()) { |
95 | 95 | $properties = self::getClassProperties($selfReflector->getParentClass()->getName()); |