@@ -6,7 +6,7 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | interface TemplateInterface |
| 8 | 8 | { |
| 9 | - public function get(string $name=null, $default=null); |
|
| 9 | + public function get(string $name = null, $default = null); |
|
| 10 | 10 | public function set(string $name, $value); |
| 11 | 11 | public function has(string $name); |
| 12 | 12 | public function assign(array $values); |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace suda\component\debug; |
| 3 | 3 | |
| 4 | -interface ConfigInterface { |
|
| 4 | +interface ConfigInterface { |
|
| 5 | 5 | public function applyConfig(array $config); |
| 6 | 6 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | class Event |
| 10 | 10 | { |
| 11 | - protected $eventListener=[]; |
|
| 11 | + protected $eventListener = []; |
|
| 12 | 12 | |
| 13 | 13 | public function loadConfig(string $path, array $extra = []) |
| 14 | 14 | { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function add(string $name, $command) |
| 55 | 55 | { |
| 56 | - $this->eventListener[$name][]=$command; |
|
| 56 | + $this->eventListener[$name][] = $command; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function addTop(string $name, $command) |
| 67 | 67 | { |
| 68 | - if (\array_key_exists($name, $this->eventListener[$name]) && is_array($this->eventListener[$name])) { |
|
| 68 | + if (\array_key_exists($name, $this->eventListener[$name]) && is_array($this->eventListener[$name])) { |
|
| 69 | 69 | array_unshift($this->eventListener[$name], $command); |
| 70 | 70 | } else { |
| 71 | 71 | $this->add($name, $command); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function remove(string $name, $remove) |
| 83 | 83 | { |
| 84 | - if (\array_key_exists($name, $this->eventListener[$name]) && is_array($this->eventListener[$name])) { |
|
| 84 | + if (\array_key_exists($name, $this->eventListener[$name]) && is_array($this->eventListener[$name])) { |
|
| 85 | 85 | foreach ($this->eventListener[$name] as $key=>$command) { |
| 86 | 86 | if ($command === $remove) { |
| 87 | 87 | unset($this->eventListener[$name][$key]); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param array $args |
| 102 | 102 | * @return void |
| 103 | 103 | */ |
| 104 | - public function exec(string $name, array $args=[]) |
|
| 104 | + public function exec(string $name, array $args = []) |
|
| 105 | 105 | { |
| 106 | 106 | if ($this->exist($name)) { |
| 107 | 107 | foreach ($this->eventListener[$name] as $command) { |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | * @param boolean $condition |
| 119 | 119 | * @return boolean |
| 120 | 120 | */ |
| 121 | - public function execIf(string $name, array $args=[], $condition = true):bool |
|
| 121 | + public function execIf(string $name, array $args = [], $condition = true):bool |
|
| 122 | 122 | { |
| 123 | 123 | if ($this->exist($name)) { |
| 124 | 124 | foreach ($this->eventListener[$name] as $command) { |
| 125 | - if ($this->call($command, $args)===$condition) { |
|
| 125 | + if ($this->call($command, $args) === $condition) { |
|
| 126 | 126 | return true; |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | * @param array $args |
| 138 | 138 | * @return mixed|null |
| 139 | 139 | */ |
| 140 | - public function execNotNull(string $name, array $args=[]) |
|
| 140 | + public function execNotNull(string $name, array $args = []) |
|
| 141 | 141 | { |
| 142 | 142 | if ($this->exist($name)) { |
| 143 | 143 | foreach ($this->eventListener[$name] as $command) { |
| 144 | - if (!is_null($value=$this->call($command, $args))) { |
|
| 144 | + if (!is_null($value = $this->call($command, $args))) { |
|
| 145 | 145 | return $value; |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param array $args |
| 157 | 157 | * @return mixed|null |
| 158 | 158 | */ |
| 159 | - public function execTop(string $name, array $args=[]) |
|
| 159 | + public function execTop(string $name, array $args = []) |
|
| 160 | 160 | { |
| 161 | 161 | debug()->trace($name); |
| 162 | 162 | if ($this->exist($name)) { |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param array $args |
| 173 | 173 | * @return mixed|null |
| 174 | 174 | */ |
| 175 | - public function execTail(string $name, array $args=[]) |
|
| 175 | + public function execTail(string $name, array $args = []) |
|
| 176 | 176 | { |
| 177 | 177 | debug()->trace($name); |
| 178 | 178 | if ($this->exist($name)) { |
@@ -14,14 +14,14 @@ discard block |
||
| 14 | 14 | * |
| 15 | 15 | * @var array |
| 16 | 16 | */ |
| 17 | - protected $value=[]; |
|
| 17 | + protected $value = []; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * 渲染堆栈 |
| 21 | 21 | * |
| 22 | 22 | * @var array |
| 23 | 23 | */ |
| 24 | - protected static $renderStack=[]; |
|
| 24 | + protected static $renderStack = []; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * 模板名 |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @var array |
| 52 | 52 | */ |
| 53 | - protected $hooks=[]; |
|
| 53 | + protected $hooks = []; |
|
| 54 | 54 | |
| 55 | - public function get(string $name=null, $default=null) |
|
| 55 | + public function get(string $name = null, $default = null) |
|
| 56 | 56 | { |
| 57 | 57 | } |
| 58 | 58 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function setParent(TemplateInterface $template) |
| 80 | 80 | { |
| 81 | - $this->parent=$template; |
|
| 81 | + $this->parent = $template; |
|
| 82 | 82 | return $this; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | protected function popRenderStack() |
| 131 | 131 | { |
| 132 | 132 | array_pop(static::$renderStack); |
| 133 | - $content=trim(ob_get_clean()); |
|
| 133 | + $content = trim(ob_get_clean()); |
|
| 134 | 134 | return $content; |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -4,15 +4,15 @@ |
||
| 4 | 4 | use suda\application\Loader; |
| 5 | 5 | use suda\application\Request; |
| 6 | 6 | |
| 7 | -require_once __DIR__ .'/loader.php'; |
|
| 7 | +require_once __DIR__.'/loader.php'; |
|
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | // 初始化系统加载器 |
| 12 | 12 | $loader = new Loader; |
| 13 | 13 | $loader->register(); |
| 14 | -$loader->addIncludePath(NEBULA_SYSTEM .'/src', 'suda'); |
|
| 15 | -$loader->import(NEBULA_SYSTEM .'/src/functions.php'); |
|
| 14 | +$loader->addIncludePath(NEBULA_SYSTEM.'/src', 'suda'); |
|
| 15 | +$loader->import(NEBULA_SYSTEM.'/src/functions.php'); |
|
| 16 | 16 | // 初始化请求 |
| 17 | 17 | $request = Request::buildFromServer(); |
| 18 | 18 | $request->apply(true); |