@@ -60,40 +60,40 @@ |
||
60 | 60 | $arrInput = explode('/', $controller_action); |
61 | 61 | $controller = ucfirst(strtolower($arrInput[0])); |
62 | 62 | $action = ucfirst(strtolower($arrInput[1])); |
63 | - if($action == null) { |
|
63 | + if ($action == null) { |
|
64 | 64 | $action = 'Index'; |
65 | 65 | } |
66 | 66 | // set action and id |
67 | - $action = 'action' . $action; |
|
67 | + $action = 'action'.$action; |
|
68 | 68 | $id = null; |
69 | 69 | if (isset($argv[2])) { |
70 | 70 | $id = $argv[2]; |
71 | 71 | } |
72 | 72 | |
73 | 73 | try { |
74 | - $controller_path = '/Apps/Controller/' . env_name . '/' . $controller . '.php'; |
|
75 | - if(file_exists(root . $controller_path) && is_readable(root . $controller_path)) { |
|
76 | - include_once(root . $controller_path); |
|
77 | - $cname = 'Apps\Controller\\' . env_name . '\\' . $controller; |
|
78 | - if(class_exists($cname)) { |
|
74 | + $controller_path = '/Apps/Controller/'.env_name.'/'.$controller.'.php'; |
|
75 | + if (file_exists(root.$controller_path) && is_readable(root.$controller_path)) { |
|
76 | + include_once(root.$controller_path); |
|
77 | + $cname = 'Apps\Controller\\'.env_name.'\\'.$controller; |
|
78 | + if (class_exists($cname)) { |
|
79 | 79 | $load = new $cname; |
80 | - if(method_exists($cname, $action)) { |
|
81 | - if($id !== null) { |
|
80 | + if (method_exists($cname, $action)) { |
|
81 | + if ($id !== null) { |
|
82 | 82 | $output = @$load->$action($id); |
83 | 83 | } else { |
84 | 84 | $output = @$load->$action(); |
85 | 85 | } |
86 | 86 | } else { |
87 | - throw new NativeException('Method ' . $action . '() not founded in ' . $cname . ' in file {root}' . $controller_path); |
|
87 | + throw new NativeException('Method '.$action.'() not founded in '.$cname.' in file {root}'.$controller_path); |
|
88 | 88 | } |
89 | 89 | unset($load); |
90 | 90 | } else { |
91 | - throw new NativeException('Namespace\\Class - ' . $cname . ' not founded in {root}' . $controller_path); |
|
91 | + throw new NativeException('Namespace\\Class - '.$cname.' not founded in {root}'.$controller_path); |
|
92 | 92 | } |
93 | 93 | } else { |
94 | - throw new NativeException('Controller not founded: {root}' . $controller_path); |
|
94 | + throw new NativeException('Controller not founded: {root}'.$controller_path); |
|
95 | 95 | } |
96 | - } catch(NativeException $e) { |
|
96 | + } catch (NativeException $e) { |
|
97 | 97 | $e->display($e->getMessage()); |
98 | 98 | } |
99 | 99 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | public function writeTab($text) |
13 | 13 | { |
14 | - return "\t->" . $this->write($text); |
|
14 | + return "\t->".$this->write($text); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function writeHeader($text) |
22 | 22 | { |
23 | - return '=== ' . strip_tags((string)$text) . ' ===' . PHP_EOL; |
|
23 | + return '=== '.strip_tags((string)$text).' ==='.PHP_EOL; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -30,6 +30,6 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function write($text) |
32 | 32 | { |
33 | - return strip_tags((string)$text) . PHP_EOL; |
|
33 | + return strip_tags((string)$text).PHP_EOL; |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | \ No newline at end of file |