@@ -13,9 +13,9 @@ discard block |
||
13 | 13 | use phoponent\framework\traits\command; |
14 | 14 | |
15 | 15 | class make { |
16 | - use command; |
|
16 | + use command; |
|
17 | 17 | |
18 | - private function create_component($type, $tag) { |
|
18 | + private function create_component($type, $tag) { |
|
19 | 19 | if(!is_dir("phoponent/app/components/{$type}/{$tag}")) { |
20 | 20 | mkdir("phoponent/app/components/{$type}/{$tag}/models", 0777, true); |
21 | 21 | mkdir("phoponent/app/components/{$type}/{$tag}/views/src", 0777, true); |
@@ -70,21 +70,21 @@ discard block |
||
70 | 70 | ); |
71 | 71 | } |
72 | 72 | |
73 | - public function component() { |
|
74 | - if(($tag = $this->argument('tag')) !== null) { |
|
75 | - $tag = ucfirst($tag); |
|
76 | - $type = $this->argument('type') ? $this->argument('type') : 'core'; |
|
77 | - if($type === 'custom' && !is_dir("phoponent/app/components/core/{$tag}")) { |
|
73 | + public function component() { |
|
74 | + if(($tag = $this->argument('tag')) !== null) { |
|
75 | + $tag = ucfirst($tag); |
|
76 | + $type = $this->argument('type') ? $this->argument('type') : 'core'; |
|
77 | + if($type === 'custom' && !is_dir("phoponent/app/components/core/{$tag}")) { |
|
78 | 78 | $this->create_component('core', $tag); |
79 | 79 | $this->create_component('custom', $tag); |
80 | 80 | } |
81 | 81 | else { |
82 | 82 | $this->create_component($type, $tag); |
83 | 83 | } |
84 | - } |
|
85 | - } |
|
84 | + } |
|
85 | + } |
|
86 | 86 | |
87 | - public function debug() { |
|
87 | + public function debug() { |
|
88 | 88 | debug::set_debug(); |
89 | 89 | } |
90 | 90 | } |
91 | 91 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use command; |
17 | 17 | |
18 | 18 | private function create_component($type, $tag) { |
19 | - if(!is_dir("phoponent/app/components/{$type}/{$tag}")) { |
|
19 | + if (!is_dir("phoponent/app/components/{$type}/{$tag}")) { |
|
20 | 20 | mkdir("phoponent/app/components/{$type}/{$tag}/models", 0777, true); |
21 | 21 | mkdir("phoponent/app/components/{$type}/{$tag}/views/src", 0777, true); |
22 | 22 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | "<?php |
26 | 26 | namespace phoponent\app\component\\$type; |
27 | 27 | |
28 | -".( $type === 'core' ? "use phoponent\\framework\\classe\\xphp_tag;" : '' )." |
|
28 | +".($type === 'core' ? "use phoponent\\framework\\classe\\xphp_tag;" : '')." |
|
29 | 29 | class {$tag} extends ".($type === 'custom' ? '\phoponent\app\component\core\\'.$tag : 'xphp_tag')." { |
30 | 30 | public function render():string { |
31 | 31 | \$hello_world = \$this->get_model('{$tag}')->get_hello_world(); |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | public function component() { |
74 | - if(($tag = $this->argument('tag')) !== null) { |
|
74 | + if (($tag = $this->argument('tag')) !== null) { |
|
75 | 75 | $tag = ucfirst($tag); |
76 | 76 | $type = $this->argument('type') ? $this->argument('type') : 'core'; |
77 | - if($type === 'custom' && !is_dir("phoponent/app/components/core/{$tag}")) { |
|
77 | + if ($type === 'custom' && !is_dir("phoponent/app/components/core/{$tag}")) { |
|
78 | 78 | $this->create_component('core', $tag); |
79 | 79 | $this->create_component('custom', $tag); |
80 | 80 | } |
@@ -77,8 +77,7 @@ |
||
77 | 77 | if($type === 'custom' && !is_dir("phoponent/app/components/core/{$tag}")) { |
78 | 78 | $this->create_component('core', $tag); |
79 | 79 | $this->create_component('custom', $tag); |
80 | - } |
|
81 | - else { |
|
80 | + } else { |
|
82 | 81 | $this->create_component($type, $tag); |
83 | 82 | } |
84 | 83 | } |
@@ -12,40 +12,40 @@ |
||
12 | 12 | use phoponent\framework\traits\command; |
13 | 13 | |
14 | 14 | class help { |
15 | - use command; |
|
16 | - |
|
17 | - private $commands = []; |
|
18 | - |
|
19 | - protected function after_connstruct() { |
|
20 | - self::$LOG_FILE = 'phoponent/logs/commands/help.log'; |
|
21 | - } |
|
22 | - |
|
23 | - protected function before_run() { |
|
24 | - $this->commands[] = '-h'; |
|
25 | - $this->commands[] = '--help'; |
|
26 | - $this->commands[] = 'make:component tag=<valeur> ?type=<core/custom>'; |
|
27 | - $this->commands[] = ''; |
|
28 | - $this->commands[] = ''; |
|
29 | - $this->commands[] = 'LEGENDE : '; |
|
30 | - $this->commands[] = '? = optionnel'; |
|
31 | - } |
|
32 | - |
|
33 | - protected function run() { |
|
34 | - echo '/**********************************************/'."\n"; |
|
35 | - echo '/* © '.date('Y').' - Phoponent *************************/'."\n"; |
|
36 | - echo '/* Author: Nicolas Choquet ********************/'."\n"; |
|
37 | - echo '/* LICENSE GPL ( GNU General Public License ) */'."\n"; |
|
38 | - echo '/**********************************************/'."\n\n"; |
|
39 | - echo "/***********************************************************************/\n"; |
|
40 | - echo "/* PPPPPP hh tt */\n"; |
|
15 | + use command; |
|
16 | + |
|
17 | + private $commands = []; |
|
18 | + |
|
19 | + protected function after_connstruct() { |
|
20 | + self::$LOG_FILE = 'phoponent/logs/commands/help.log'; |
|
21 | + } |
|
22 | + |
|
23 | + protected function before_run() { |
|
24 | + $this->commands[] = '-h'; |
|
25 | + $this->commands[] = '--help'; |
|
26 | + $this->commands[] = 'make:component tag=<valeur> ?type=<core/custom>'; |
|
27 | + $this->commands[] = ''; |
|
28 | + $this->commands[] = ''; |
|
29 | + $this->commands[] = 'LEGENDE : '; |
|
30 | + $this->commands[] = '? = optionnel'; |
|
31 | + } |
|
32 | + |
|
33 | + protected function run() { |
|
34 | + echo '/**********************************************/'."\n"; |
|
35 | + echo '/* © '.date('Y').' - Phoponent *************************/'."\n"; |
|
36 | + echo '/* Author: Nicolas Choquet ********************/'."\n"; |
|
37 | + echo '/* LICENSE GPL ( GNU General Public License ) */'."\n"; |
|
38 | + echo '/**********************************************/'."\n\n"; |
|
39 | + echo "/***********************************************************************/\n"; |
|
40 | + echo "/* PPPPPP hh tt */\n"; |
|
41 | 41 | echo "/* PP PP hh oooo pp pp oooo nn nnn eee nn nnn tt */\n"; |
42 | 42 | echo "/* PPPPPP hhhhhh oo oo ppp pp oo oo nnn nn ee e nnn nn tttt */\n"; |
43 | 43 | echo "/* PP hh hh oo oo pppppp oo oo nn nn eeeee nn nn tt */\n"; |
44 | 44 | echo "/* PP hh hh oooo pp oooo nn nn eeeee nn nn tttt */\n"; |
45 | 45 | echo "/* pp */\n"; |
46 | 46 | echo "/***********************************************************************/\n\n"; |
47 | - foreach ($this->commands as $command) { |
|
48 | - $this->log($command); |
|
49 | - } |
|
50 | - } |
|
47 | + foreach ($this->commands as $command) { |
|
48 | + $this->log($command); |
|
49 | + } |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | \ No newline at end of file |
@@ -22,25 +22,25 @@ discard block |
||
22 | 22 | } |
23 | 23 | } |
24 | 24 | |
25 | - public static function load() { |
|
26 | - require_once 'traits/static_class.php'; |
|
25 | + public static function load() { |
|
26 | + require_once 'traits/static_class.php'; |
|
27 | 27 | require_once 'classes/debug.php'; |
28 | 28 | self::debug_page(); |
29 | - require_once 'traits/view.php'; |
|
30 | - require_once 'traits/model.php'; |
|
31 | - require_once 'traits/service.php'; |
|
32 | - require_once 'traits/command.php'; |
|
33 | - require_once 'classes/regexp.php'; |
|
34 | - require_once 'classes/xphp.php'; |
|
35 | - require_once 'classes/xphp_tag.php'; |
|
36 | - require_once 'classes/command.php'; |
|
29 | + require_once 'traits/view.php'; |
|
30 | + require_once 'traits/model.php'; |
|
31 | + require_once 'traits/service.php'; |
|
32 | + require_once 'traits/command.php'; |
|
33 | + require_once 'classes/regexp.php'; |
|
34 | + require_once 'classes/xphp.php'; |
|
35 | + require_once 'classes/xphp_tag.php'; |
|
36 | + require_once 'classes/command.php'; |
|
37 | 37 | |
38 | - require_once 'classes/index.php'; |
|
39 | - } |
|
38 | + require_once 'classes/index.php'; |
|
39 | + } |
|
40 | 40 | |
41 | - public static function dependencies() { |
|
42 | - self::$dependencies = [ |
|
43 | - // Framework |
|
41 | + public static function dependencies() { |
|
42 | + self::$dependencies = [ |
|
43 | + // Framework |
|
44 | 44 | |
45 | 45 | // Traits |
46 | 46 | 'traits' => [ |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | 'path' => __DIR__.'/classes/command.php', |
85 | 85 | \phoponent\framework\static_classe\command::class, |
86 | 86 | ], |
87 | - ], |
|
87 | + ], |
|
88 | 88 | |
89 | 89 | // Services |
90 | 90 | 'services' => [ |
@@ -113,18 +113,18 @@ discard block |
||
113 | 113 | 'class' => \phoponent\framework\command\make::class, |
114 | 114 | ] |
115 | 115 | ], |
116 | - ]; |
|
117 | - } |
|
116 | + ]; |
|
117 | + } |
|
118 | 118 | |
119 | - public static function dependencie($type, $name = null) { |
|
120 | - self::dependencies(); |
|
121 | - if($name) { |
|
122 | - if(isset(self::$dependencies[$type][$name]) && is_file(self::$dependencies[$type][$name]['path'])) { |
|
123 | - require_once self::$dependencies[$type][$name]['path']; |
|
124 | - return self::$dependencies[$type][$name]['class']; |
|
119 | + public static function dependencie($type, $name = null) { |
|
120 | + self::dependencies(); |
|
121 | + if($name) { |
|
122 | + if(isset(self::$dependencies[$type][$name]) && is_file(self::$dependencies[$type][$name]['path'])) { |
|
123 | + require_once self::$dependencies[$type][$name]['path']; |
|
124 | + return self::$dependencies[$type][$name]['class']; |
|
125 | 125 | } |
126 | 126 | return null; |
127 | 127 | } |
128 | - return isset(self::$dependencies[$type]) ? self::$dependencies[$type] : null; |
|
128 | + return isset(self::$dependencies[$type]) ? self::$dependencies[$type] : null; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | \ No newline at end of file |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | private static function debug_page() { |
19 | 19 | ini_set('display_errors', 'off'); |
20 | - if(debug::get_debug()) { |
|
20 | + if (debug::get_debug()) { |
|
21 | 21 | ini_set('display_errors', 'on'); |
22 | 22 | } |
23 | 23 | } |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | |
119 | 119 | public static function dependencie($type, $name = null) { |
120 | 120 | self::dependencies(); |
121 | - if($name) { |
|
122 | - if(isset(self::$dependencies[$type][$name]) && is_file(self::$dependencies[$type][$name]['path'])) { |
|
121 | + if ($name) { |
|
122 | + if (isset(self::$dependencies[$type][$name]) && is_file(self::$dependencies[$type][$name]['path'])) { |
|
123 | 123 | require_once self::$dependencies[$type][$name]['path']; |
124 | 124 | return self::$dependencies[$type][$name]['class']; |
125 | 125 | } |
@@ -10,5 +10,5 @@ |
||
10 | 10 | namespace phoponent\framework\traits; |
11 | 11 | |
12 | 12 | trait static_class { |
13 | - private function __construct() {} |
|
13 | + private function __construct() {} |
|
14 | 14 | } |
15 | 15 | \ No newline at end of file |
@@ -12,63 +12,63 @@ |
||
12 | 12 | use Exception; |
13 | 13 | |
14 | 14 | trait command { |
15 | - private $argv = []; |
|
15 | + private $argv = []; |
|
16 | 16 | |
17 | - protected static $LOG_ECHO = 'echo'; |
|
18 | - protected static $LOG_FILE = ''; |
|
17 | + protected static $LOG_ECHO = 'echo'; |
|
18 | + protected static $LOG_FILE = ''; |
|
19 | 19 | |
20 | - public function __construct($argv = []) { |
|
21 | - $this->argv = $argv; |
|
22 | - $this->after_connstruct(); |
|
23 | - } |
|
20 | + public function __construct($argv = []) { |
|
21 | + $this->argv = $argv; |
|
22 | + $this->after_connstruct(); |
|
23 | + } |
|
24 | 24 | |
25 | - protected function after_connstruct() {} |
|
25 | + protected function after_connstruct() {} |
|
26 | 26 | |
27 | - protected function log($text = '', $type_log = 'echo') { |
|
28 | - if ($type_log === self::$LOG_FILE) { |
|
29 | - $path = str_replace('/'.basename(self::$LOG_FILE), '', self::$LOG_FILE); |
|
30 | - if(!is_dir($path)) { |
|
31 | - mkdir($path, 0777, true); |
|
32 | - } |
|
33 | - $content = ''; |
|
34 | - if(is_file(self::$LOG_FILE)) { |
|
35 | - $content = file_get_contents(self::$LOG_FILE); |
|
36 | - } |
|
27 | + protected function log($text = '', $type_log = 'echo') { |
|
28 | + if ($type_log === self::$LOG_FILE) { |
|
29 | + $path = str_replace('/'.basename(self::$LOG_FILE), '', self::$LOG_FILE); |
|
30 | + if(!is_dir($path)) { |
|
31 | + mkdir($path, 0777, true); |
|
32 | + } |
|
33 | + $content = ''; |
|
34 | + if(is_file(self::$LOG_FILE)) { |
|
35 | + $content = file_get_contents(self::$LOG_FILE); |
|
36 | + } |
|
37 | 37 | |
38 | - file_put_contents(self::$LOG_FILE, $content."\n".date('#~ '.exec('echo $USER').': '.$text)); |
|
39 | - } |
|
40 | - else { |
|
41 | - echo date('Y-m-d H:i:s').' '.exec('echo $USER').' #~ '.$text."\n"; |
|
42 | - } |
|
43 | - } |
|
38 | + file_put_contents(self::$LOG_FILE, $content."\n".date('#~ '.exec('echo $USER').': '.$text)); |
|
39 | + } |
|
40 | + else { |
|
41 | + echo date('Y-m-d H:i:s').' '.exec('echo $USER').' #~ '.$text."\n"; |
|
42 | + } |
|
43 | + } |
|
44 | 44 | |
45 | - protected function before_run() {} |
|
45 | + protected function before_run() {} |
|
46 | 46 | |
47 | - protected function after_run() {} |
|
47 | + protected function after_run() {} |
|
48 | 48 | |
49 | - protected function run() {} |
|
49 | + protected function run() {} |
|
50 | 50 | |
51 | - protected function argument($name) { |
|
52 | - foreach ($this->argv as $argv) { |
|
53 | - if(explode('=', $argv)[0] === $name) { |
|
54 | - return explode('=', $argv)[1]; |
|
55 | - } |
|
56 | - } |
|
57 | - return null; |
|
58 | - } |
|
51 | + protected function argument($name) { |
|
52 | + foreach ($this->argv as $argv) { |
|
53 | + if(explode('=', $argv)[0] === $name) { |
|
54 | + return explode('=', $argv)[1]; |
|
55 | + } |
|
56 | + } |
|
57 | + return null; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * @param string $method |
|
62 | - * @return bool |
|
63 | - * @throws Exception |
|
64 | - */ |
|
65 | - public function execute($method = 'run') { |
|
66 | - $this->before_run(); |
|
67 | - if(in_array($method, get_class_methods(get_class($this)))) { |
|
68 | - $this->$method(); |
|
69 | - $this->after_run(); |
|
70 | - return true; |
|
71 | - } |
|
72 | - throw new Exception("method ".explode('\\', __CLASS__)[count(explode('\\', __CLASS__))-1]."::{$method}() not found"); |
|
73 | - } |
|
60 | + /** |
|
61 | + * @param string $method |
|
62 | + * @return bool |
|
63 | + * @throws Exception |
|
64 | + */ |
|
65 | + public function execute($method = 'run') { |
|
66 | + $this->before_run(); |
|
67 | + if(in_array($method, get_class_methods(get_class($this)))) { |
|
68 | + $this->$method(); |
|
69 | + $this->after_run(); |
|
70 | + return true; |
|
71 | + } |
|
72 | + throw new Exception("method ".explode('\\', __CLASS__)[count(explode('\\', __CLASS__))-1]."::{$method}() not found"); |
|
73 | + } |
|
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -27,11 +27,11 @@ discard block |
||
27 | 27 | protected function log($text = '', $type_log = 'echo') { |
28 | 28 | if ($type_log === self::$LOG_FILE) { |
29 | 29 | $path = str_replace('/'.basename(self::$LOG_FILE), '', self::$LOG_FILE); |
30 | - if(!is_dir($path)) { |
|
30 | + if (!is_dir($path)) { |
|
31 | 31 | mkdir($path, 0777, true); |
32 | 32 | } |
33 | 33 | $content = ''; |
34 | - if(is_file(self::$LOG_FILE)) { |
|
34 | + if (is_file(self::$LOG_FILE)) { |
|
35 | 35 | $content = file_get_contents(self::$LOG_FILE); |
36 | 36 | } |
37 | 37 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | protected function argument($name) { |
52 | 52 | foreach ($this->argv as $argv) { |
53 | - if(explode('=', $argv)[0] === $name) { |
|
53 | + if (explode('=', $argv)[0] === $name) { |
|
54 | 54 | return explode('=', $argv)[1]; |
55 | 55 | } |
56 | 56 | } |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function execute($method = 'run') { |
66 | 66 | $this->before_run(); |
67 | - if(in_array($method, get_class_methods(get_class($this)))) { |
|
67 | + if (in_array($method, get_class_methods(get_class($this)))) { |
|
68 | 68 | $this->$method(); |
69 | 69 | $this->after_run(); |
70 | 70 | return true; |
71 | 71 | } |
72 | - throw new Exception("method ".explode('\\', __CLASS__)[count(explode('\\', __CLASS__))-1]."::{$method}() not found"); |
|
72 | + throw new Exception("method ".explode('\\', __CLASS__)[count(explode('\\', __CLASS__)) - 1]."::{$method}() not found"); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | \ No newline at end of file |
@@ -36,8 +36,7 @@ |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | file_put_contents(self::$LOG_FILE, $content."\n".date('#~ '.exec('echo $USER').': '.$text)); |
39 | - } |
|
40 | - else { |
|
39 | + } else { |
|
41 | 40 | echo date('Y-m-d H:i:s').' '.exec('echo $USER').' #~ '.$text."\n"; |
42 | 41 | } |
43 | 42 | } |
@@ -10,25 +10,25 @@ |
||
10 | 10 | namespace phoponent\framework\traits; |
11 | 11 | |
12 | 12 | trait service { |
13 | - public function get($name) { |
|
14 | - if(in_array($name, get_class_vars(get_class($this)))) { |
|
15 | - return $this->$name; |
|
16 | - } |
|
17 | - elseif (in_array("get_{$name}", get_class_methods($this))) { |
|
18 | - $func = "get_{$name}"; |
|
19 | - return $this->$func(); |
|
20 | - } |
|
21 | - return null; |
|
22 | - } |
|
13 | + public function get($name) { |
|
14 | + if(in_array($name, get_class_vars(get_class($this)))) { |
|
15 | + return $this->$name; |
|
16 | + } |
|
17 | + elseif (in_array("get_{$name}", get_class_methods($this))) { |
|
18 | + $func = "get_{$name}"; |
|
19 | + return $this->$func(); |
|
20 | + } |
|
21 | + return null; |
|
22 | + } |
|
23 | 23 | |
24 | - public function set($name, $value) { |
|
25 | - if(in_array($name, array_keys(get_class_vars(get_class($this))))) { |
|
26 | - $this->$name = $value; |
|
27 | - } |
|
28 | - elseif (in_array("set_{$name}", get_class_methods($this))) { |
|
29 | - $func = "set_{$name}"; |
|
30 | - return $this->$func($value); |
|
31 | - } |
|
32 | - return $this; |
|
33 | - } |
|
24 | + public function set($name, $value) { |
|
25 | + if(in_array($name, array_keys(get_class_vars(get_class($this))))) { |
|
26 | + $this->$name = $value; |
|
27 | + } |
|
28 | + elseif (in_array("set_{$name}", get_class_methods($this))) { |
|
29 | + $func = "set_{$name}"; |
|
30 | + return $this->$func($value); |
|
31 | + } |
|
32 | + return $this; |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | trait service { |
13 | 13 | public function get($name) { |
14 | - if(in_array($name, get_class_vars(get_class($this)))) { |
|
14 | + if (in_array($name, get_class_vars(get_class($this)))) { |
|
15 | 15 | return $this->$name; |
16 | 16 | } |
17 | 17 | elseif (in_array("get_{$name}", get_class_methods($this))) { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | public function set($name, $value) { |
25 | - if(in_array($name, array_keys(get_class_vars(get_class($this))))) { |
|
25 | + if (in_array($name, array_keys(get_class_vars(get_class($this))))) { |
|
26 | 26 | $this->$name = $value; |
27 | 27 | } |
28 | 28 | elseif (in_array("set_{$name}", get_class_methods($this))) { |
@@ -13,8 +13,7 @@ discard block |
||
13 | 13 | public function get($name) { |
14 | 14 | if(in_array($name, get_class_vars(get_class($this)))) { |
15 | 15 | return $this->$name; |
16 | - } |
|
17 | - elseif (in_array("get_{$name}", get_class_methods($this))) { |
|
16 | + } elseif (in_array("get_{$name}", get_class_methods($this))) { |
|
18 | 17 | $func = "get_{$name}"; |
19 | 18 | return $this->$func(); |
20 | 19 | } |
@@ -24,8 +23,7 @@ discard block |
||
24 | 23 | public function set($name, $value) { |
25 | 24 | if(in_array($name, array_keys(get_class_vars(get_class($this))))) { |
26 | 25 | $this->$name = $value; |
27 | - } |
|
28 | - elseif (in_array("set_{$name}", get_class_methods($this))) { |
|
26 | + } elseif (in_array("set_{$name}", get_class_methods($this))) { |
|
29 | 27 | $func = "set_{$name}"; |
30 | 28 | return $this->$func($value); |
31 | 29 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | protected $component = ''; |
18 | 18 | |
19 | 19 | public function __construct($path) { |
20 | - $view_name = explode('\\', get_class($this))[count(explode('\\', get_class($this)))-1]; |
|
20 | + $view_name = explode('\\', get_class($this))[count(explode('\\', get_class($this)))-1]; |
|
21 | 21 | if(is_file("{$path}/src/{$view_name}.view.html")) { |
22 | 22 | $this->template = file_get_contents("{$path}/src/{$view_name}.view.html"); |
23 | 23 | } |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | |
43 | 43 | public function before_render() {} |
44 | 44 | |
45 | - protected function render_end(&$template) { |
|
46 | - xphp::parse_template_content($template); |
|
47 | - } |
|
45 | + protected function render_end(&$template) { |
|
46 | + xphp::parse_template_content($template); |
|
47 | + } |
|
48 | 48 | |
49 | 49 | public function render():string { |
50 | 50 | $this->before_render(); |
@@ -17,14 +17,14 @@ |
||
17 | 17 | protected $component = ''; |
18 | 18 | |
19 | 19 | public function __construct($path) { |
20 | - $view_name = explode('\\', get_class($this))[count(explode('\\', get_class($this)))-1]; |
|
21 | - if(is_file("{$path}/src/{$view_name}.view.html")) { |
|
20 | + $view_name = explode('\\', get_class($this))[count(explode('\\', get_class($this))) - 1]; |
|
21 | + if (is_file("{$path}/src/{$view_name}.view.html")) { |
|
22 | 22 | $this->template = file_get_contents("{$path}/src/{$view_name}.view.html"); |
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | 26 | public function set_parent($parent_class) { |
27 | - if(strstr(__CLASS__, 'custom')) { |
|
27 | + if (strstr(__CLASS__, 'custom')) { |
|
28 | 28 | $this->set_vars(['parent' => $parent_class->get_template()]); |
29 | 29 | } |
30 | 30 | } |
@@ -10,26 +10,26 @@ |
||
10 | 10 | namespace phoponent\framework\traits; |
11 | 11 | |
12 | 12 | trait model { |
13 | - private $services = []; |
|
14 | - private $component = ''; |
|
13 | + private $services = []; |
|
14 | + private $component = ''; |
|
15 | 15 | public function __construct($services, string $component) { |
16 | 16 | $this->services = $services; |
17 | - $this->component = $component; |
|
17 | + $this->component = $component; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | protected function get_services() { |
21 | - return $this->services; |
|
22 | - } |
|
21 | + return $this->services; |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * @param $name |
|
26 | - * @return service|null |
|
27 | - */ |
|
28 | - protected function get_service($name) { |
|
29 | - return isset($this->services[$name]) ? $this->services[$name] : null; |
|
30 | - } |
|
24 | + /** |
|
25 | + * @param $name |
|
26 | + * @return service|null |
|
27 | + */ |
|
28 | + protected function get_service($name) { |
|
29 | + return isset($this->services[$name]) ? $this->services[$name] : null; |
|
30 | + } |
|
31 | 31 | |
32 | - public function get_component() { |
|
33 | - return $this->component; |
|
34 | - } |
|
32 | + public function get_component() { |
|
33 | + return $this->component; |
|
34 | + } |
|
35 | 35 | } |
36 | 36 | \ No newline at end of file |
@@ -12,15 +12,15 @@ |
||
12 | 12 | use phoponent\framework\traits\service; |
13 | 13 | |
14 | 14 | class json_reader { |
15 | - use service; |
|
16 | - protected $file = ''; |
|
15 | + use service; |
|
16 | + protected $file = ''; |
|
17 | 17 | |
18 | - public function set_file($file) { |
|
19 | - $this->file = "$file.json"; |
|
20 | - return $this; |
|
21 | - } |
|
18 | + public function set_file($file) { |
|
19 | + $this->file = "$file.json"; |
|
20 | + return $this; |
|
21 | + } |
|
22 | 22 | |
23 | - public function get_datas() { |
|
24 | - return json_decode(file_get_contents($this->file)); |
|
25 | - } |
|
23 | + public function get_datas() { |
|
24 | + return json_decode(file_get_contents($this->file)); |
|
25 | + } |
|
26 | 26 | } |
27 | 27 | \ No newline at end of file |