@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | public function __construct($driver = 'console') |
68 | 68 | { |
69 | - $class = '\\think\\console\\output\\driver\\' . ucwords($driver); |
|
69 | + $class = '\\think\\console\\output\\driver\\'.ucwords($driver); |
|
70 | 70 | |
71 | 71 | $this->handle = new $class($this); |
72 | 72 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | if ($this->handle && method_exists($this->handle, $method)) { |
216 | 216 | return call_user_func_array([$this->handle, $method], $args); |
217 | 217 | } else { |
218 | - throw new Exception('method not exists:' . __CLASS__ . '->' . $method); |
|
218 | + throw new Exception('method not exists:'.__CLASS__.'->'.$method); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 |
@@ -379,7 +379,7 @@ |
||
379 | 379 | ]; |
380 | 380 | $replacements = [ |
381 | 381 | $name, |
382 | - $_SERVER['PHP_SELF'] . ' ' . $name, |
|
382 | + $_SERVER['PHP_SELF'].' '.$name, |
|
383 | 383 | ]; |
384 | 384 | |
385 | 385 | return str_replace($placeholders, $replacements, $this->getHelp()); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | public function tagPhp($tag, $content) |
64 | 64 | { |
65 | - $parseStr = '<?php ' . $content . ' ?>'; |
|
65 | + $parseStr = '<?php '.$content.' ?>'; |
|
66 | 66 | return $parseStr; |
67 | 67 | } |
68 | 68 | |
@@ -93,28 +93,28 @@ discard block |
||
93 | 93 | |
94 | 94 | if (':' == $flag) { |
95 | 95 | $name = $this->autoBuildVar($name); |
96 | - $parseStr .= '$_result=' . $name . ';'; |
|
96 | + $parseStr .= '$_result='.$name.';'; |
|
97 | 97 | $name = '$_result'; |
98 | 98 | } else { |
99 | 99 | $name = $this->autoBuildVar($name); |
100 | 100 | } |
101 | 101 | |
102 | - $parseStr .= 'if(is_array(' . $name . ') || ' . $name . ' instanceof \think\Collection || ' . $name . ' instanceof \think\Paginator): $' . $key . ' = 0;'; |
|
102 | + $parseStr .= 'if(is_array('.$name.') || '.$name.' instanceof \think\Collection || '.$name.' instanceof \think\Paginator): $'.$key.' = 0;'; |
|
103 | 103 | |
104 | 104 | // 设置了输出数组长度 |
105 | 105 | if (0 != $offset || 'null' != $length) { |
106 | - $parseStr .= '$__LIST__ = is_array(' . $name . ') ? array_slice(' . $name . ',' . $offset . ',' . $length . ', true) : ' . $name . '->slice(' . $offset . ',' . $length . ', true); '; |
|
106 | + $parseStr .= '$__LIST__ = is_array('.$name.') ? array_slice('.$name.','.$offset.','.$length.', true) : '.$name.'->slice('.$offset.','.$length.', true); '; |
|
107 | 107 | } else { |
108 | - $parseStr .= ' $__LIST__ = ' . $name . ';'; |
|
108 | + $parseStr .= ' $__LIST__ = '.$name.';'; |
|
109 | 109 | } |
110 | 110 | |
111 | - $parseStr .= 'if( count($__LIST__)==0 ) : echo "' . $empty . '" ;'; |
|
111 | + $parseStr .= 'if( count($__LIST__)==0 ) : echo "'.$empty.'" ;'; |
|
112 | 112 | $parseStr .= 'else: '; |
113 | - $parseStr .= 'foreach($__LIST__ as $key=>$' . $id . '): '; |
|
114 | - $parseStr .= '$mod = ($' . $key . ' % ' . $mod . ' );'; |
|
115 | - $parseStr .= '++$' . $key . ';?>'; |
|
113 | + $parseStr .= 'foreach($__LIST__ as $key=>$'.$id.'): '; |
|
114 | + $parseStr .= '$mod = ($'.$key.' % '.$mod.' );'; |
|
115 | + $parseStr .= '++$'.$key.';?>'; |
|
116 | 116 | $parseStr .= $content; |
117 | - $parseStr .= '<?php endforeach; endif; else: echo "' . $empty . '" ;endif; ?>'; |
|
117 | + $parseStr .= '<?php endforeach; endif; else: echo "'.$empty.'" ;endif; ?>'; |
|
118 | 118 | |
119 | 119 | if (!empty($parseStr)) { |
120 | 120 | return $parseStr; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | if (!empty($tag['expression'])) { |
141 | 141 | $expression = ltrim(rtrim($tag['expression'], ')'), '('); |
142 | 142 | $expression = $this->autoBuildVar($expression); |
143 | - $parseStr = '<?php foreach(' . $expression . '): ?>'; |
|
143 | + $parseStr = '<?php foreach('.$expression.'): ?>'; |
|
144 | 144 | $parseStr .= $content; |
145 | 145 | $parseStr .= '<?php endforeach; ?>'; |
146 | 146 | return $parseStr; |
@@ -157,51 +157,51 @@ discard block |
||
157 | 157 | |
158 | 158 | // 支持用函数传数组 |
159 | 159 | if (':' == substr($name, 0, 1)) { |
160 | - $var = '$_' . uniqid(); |
|
160 | + $var = '$_'.uniqid(); |
|
161 | 161 | $name = $this->autoBuildVar($name); |
162 | - $parseStr .= $var . '=' . $name . '; '; |
|
162 | + $parseStr .= $var.'='.$name.'; '; |
|
163 | 163 | $name = $var; |
164 | 164 | } else { |
165 | 165 | $name = $this->autoBuildVar($name); |
166 | 166 | } |
167 | 167 | |
168 | - $parseStr .= 'if(is_array(' . $name . ') || ' . $name . ' instanceof \think\Collection || ' . $name . ' instanceof \think\Paginator): '; |
|
168 | + $parseStr .= 'if(is_array('.$name.') || '.$name.' instanceof \think\Collection || '.$name.' instanceof \think\Paginator): '; |
|
169 | 169 | |
170 | 170 | // 设置了输出数组长度 |
171 | 171 | if (0 != $offset || 'null' != $length) { |
172 | 172 | if (!isset($var)) { |
173 | - $var = '$_' . uniqid(); |
|
173 | + $var = '$_'.uniqid(); |
|
174 | 174 | } |
175 | - $parseStr .= $var . ' = is_array(' . $name . ') ? array_slice(' . $name . ',' . $offset . ',' . $length . ', true) : ' . $name . '->slice(' . $offset . ',' . $length . ', true); '; |
|
175 | + $parseStr .= $var.' = is_array('.$name.') ? array_slice('.$name.','.$offset.','.$length.', true) : '.$name.'->slice('.$offset.','.$length.', true); '; |
|
176 | 176 | } else { |
177 | 177 | $var = &$name; |
178 | 178 | } |
179 | 179 | |
180 | - $parseStr .= 'if( count(' . $var . ')==0 ) : echo "' . $empty . '" ;'; |
|
180 | + $parseStr .= 'if( count('.$var.')==0 ) : echo "'.$empty.'" ;'; |
|
181 | 181 | $parseStr .= 'else: '; |
182 | 182 | |
183 | 183 | // 设置了索引项 |
184 | 184 | if (isset($tag['index'])) { |
185 | 185 | $index = $tag['index']; |
186 | - $parseStr .= '$' . $index . '=0; '; |
|
186 | + $parseStr .= '$'.$index.'=0; '; |
|
187 | 187 | } |
188 | 188 | |
189 | - $parseStr .= 'foreach(' . $var . ' as $' . $key . '=>$' . $item . '): '; |
|
189 | + $parseStr .= 'foreach('.$var.' as $'.$key.'=>$'.$item.'): '; |
|
190 | 190 | |
191 | 191 | // 设置了索引项 |
192 | 192 | if (isset($tag['index'])) { |
193 | 193 | $index = $tag['index']; |
194 | 194 | if (isset($tag['mod'])) { |
195 | 195 | $mod = (int) $tag['mod']; |
196 | - $parseStr .= '$mod = ($' . $index . ' % ' . $mod . '); '; |
|
196 | + $parseStr .= '$mod = ($'.$index.' % '.$mod.'); '; |
|
197 | 197 | } |
198 | - $parseStr .= '++$' . $index . '; '; |
|
198 | + $parseStr .= '++$'.$index.'; '; |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | $parseStr .= '?>'; |
202 | 202 | // 循环体中的内容 |
203 | 203 | $parseStr .= $content; |
204 | - $parseStr .= '<?php endforeach; endif; else: echo "' . $empty . '" ;endif; ?>'; |
|
204 | + $parseStr .= '<?php endforeach; endif; else: echo "'.$empty.'" ;endif; ?>'; |
|
205 | 205 | |
206 | 206 | if (!empty($parseStr)) { |
207 | 207 | return $parseStr; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $condition = !empty($tag['expression']) ? $tag['expression'] : $tag['condition']; |
229 | 229 | $condition = $this->parseCondition($condition); |
230 | - $parseStr = '<?php if(' . $condition . '): ?>' . $content . '<?php endif; ?>'; |
|
230 | + $parseStr = '<?php if('.$condition.'): ?>'.$content.'<?php endif; ?>'; |
|
231 | 231 | |
232 | 232 | return $parseStr; |
233 | 233 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | { |
245 | 245 | $condition = !empty($tag['expression']) ? $tag['expression'] : $tag['condition']; |
246 | 246 | $condition = $this->parseCondition($condition); |
247 | - $parseStr = '<?php elseif(' . $condition . '): ?>'; |
|
247 | + $parseStr = '<?php elseif('.$condition.'): ?>'; |
|
248 | 248 | |
249 | 249 | return $parseStr; |
250 | 250 | } |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | { |
281 | 281 | $name = !empty($tag['expression']) ? $tag['expression'] : $tag['name']; |
282 | 282 | $name = $this->autoBuildVar($name); |
283 | - $parseStr = '<?php switch(' . $name . '): ?>' . $content . '<?php endswitch; ?>'; |
|
283 | + $parseStr = '<?php switch('.$name.'): ?>'.$content.'<?php endswitch; ?>'; |
|
284 | 284 | |
285 | 285 | return $parseStr; |
286 | 286 | } |
@@ -299,18 +299,18 @@ discard block |
||
299 | 299 | |
300 | 300 | if ('$' == $flag || ':' == $flag) { |
301 | 301 | $value = $this->autoBuildVar($value); |
302 | - $value = 'case ' . $value . ':'; |
|
302 | + $value = 'case '.$value.':'; |
|
303 | 303 | } elseif (strpos($value, '|')) { |
304 | 304 | $values = explode('|', $value); |
305 | 305 | $value = ''; |
306 | 306 | foreach ($values as $val) { |
307 | - $value .= 'case "' . addslashes($val) . '":'; |
|
307 | + $value .= 'case "'.addslashes($val).'":'; |
|
308 | 308 | } |
309 | 309 | } else { |
310 | - $value = 'case "' . $value . '":'; |
|
310 | + $value = 'case "'.$value.'":'; |
|
311 | 311 | } |
312 | 312 | |
313 | - $parseStr = '<?php ' . $value . ' ?>' . $content; |
|
313 | + $parseStr = '<?php '.$value.' ?>'.$content; |
|
314 | 314 | $isBreak = isset($tag['break']) ? $tag['break'] : ''; |
315 | 315 | |
316 | 316 | if ('' == $isBreak || $isBreak) { |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | if ('$' == $flag || ':' == $flag) { |
356 | 356 | $value = $this->autoBuildVar($value); |
357 | 357 | } else { |
358 | - $value = '\'' . $value . '\''; |
|
358 | + $value = '\''.$value.'\''; |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | switch ($type) { |
@@ -366,8 +366,8 @@ discard block |
||
366 | 366 | $type = 'neq'; |
367 | 367 | break; |
368 | 368 | } |
369 | - $type = $this->parseCondition(' ' . $type . ' '); |
|
370 | - $parseStr = '<?php if(' . $name . ' ' . $type . ' ' . $value . '): ?>' . $content . '<?php endif; ?>'; |
|
369 | + $type = $this->parseCondition(' '.$type.' '); |
|
370 | + $parseStr = '<?php if('.$name.' '.$type.' '.$value.'): ?>'.$content.'<?php endif; ?>'; |
|
371 | 371 | |
372 | 372 | return $parseStr; |
373 | 373 | } |
@@ -393,19 +393,19 @@ discard block |
||
393 | 393 | |
394 | 394 | if ('$' == $flag || ':' == $flag) { |
395 | 395 | $value = $this->autoBuildVar($value); |
396 | - $str = 'is_array(' . $value . ')?' . $value . ':explode(\',\',' . $value . ')'; |
|
396 | + $str = 'is_array('.$value.')?'.$value.':explode(\',\','.$value.')'; |
|
397 | 397 | } else { |
398 | - $value = '"' . $value . '"'; |
|
399 | - $str = 'explode(\',\',' . $value . ')'; |
|
398 | + $value = '"'.$value.'"'; |
|
399 | + $str = 'explode(\',\','.$value.')'; |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | if ('between' == $type) { |
403 | - $parseStr = '<?php $_RANGE_VAR_=' . $str . ';if(' . $name . '>= $_RANGE_VAR_[0] && ' . $name . '<= $_RANGE_VAR_[1]):?>' . $content . '<?php endif; ?>'; |
|
403 | + $parseStr = '<?php $_RANGE_VAR_='.$str.';if('.$name.'>= $_RANGE_VAR_[0] && '.$name.'<= $_RANGE_VAR_[1]):?>'.$content.'<?php endif; ?>'; |
|
404 | 404 | } elseif ('notbetween' == $type) { |
405 | - $parseStr = '<?php $_RANGE_VAR_=' . $str . ';if(' . $name . '<$_RANGE_VAR_[0] || ' . $name . '>$_RANGE_VAR_[1]):?>' . $content . '<?php endif; ?>'; |
|
405 | + $parseStr = '<?php $_RANGE_VAR_='.$str.';if('.$name.'<$_RANGE_VAR_[0] || '.$name.'>$_RANGE_VAR_[1]):?>'.$content.'<?php endif; ?>'; |
|
406 | 406 | } else { |
407 | 407 | $fun = ('in' == $type) ? 'in_array' : '!in_array'; |
408 | - $parseStr = '<?php if(' . $fun . '((' . $name . '), ' . $str . ')): ?>' . $content . '<?php endif; ?>'; |
|
408 | + $parseStr = '<?php if('.$fun.'(('.$name.'), '.$str.')): ?>'.$content.'<?php endif; ?>'; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | return $parseStr; |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | { |
425 | 425 | $name = $tag['name']; |
426 | 426 | $name = $this->autoBuildVar($name); |
427 | - $parseStr = '<?php if(isset(' . $name . ')): ?>' . $content . '<?php endif; ?>'; |
|
427 | + $parseStr = '<?php if(isset('.$name.')): ?>'.$content.'<?php endif; ?>'; |
|
428 | 428 | |
429 | 429 | return $parseStr; |
430 | 430 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | { |
443 | 443 | $name = $tag['name']; |
444 | 444 | $name = $this->autoBuildVar($name); |
445 | - $parseStr = '<?php if(!isset(' . $name . ')): ?>' . $content . '<?php endif; ?>'; |
|
445 | + $parseStr = '<?php if(!isset('.$name.')): ?>'.$content.'<?php endif; ?>'; |
|
446 | 446 | |
447 | 447 | return $parseStr; |
448 | 448 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | { |
461 | 461 | $name = $tag['name']; |
462 | 462 | $name = $this->autoBuildVar($name); |
463 | - $parseStr = '<?php if(empty(' . $name . ') || ((' . $name . ' instanceof \think\Collection || ' . $name . ' instanceof \think\Paginator ) && ' . $name . '->isEmpty())): ?>' . $content . '<?php endif; ?>'; |
|
463 | + $parseStr = '<?php if(empty('.$name.') || (('.$name.' instanceof \think\Collection || '.$name.' instanceof \think\Paginator ) && '.$name.'->isEmpty())): ?>'.$content.'<?php endif; ?>'; |
|
464 | 464 | |
465 | 465 | return $parseStr; |
466 | 466 | } |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | { |
479 | 479 | $name = $tag['name']; |
480 | 480 | $name = $this->autoBuildVar($name); |
481 | - $parseStr = '<?php if(!(empty(' . $name . ') || ((' . $name . ' instanceof \think\Collection || ' . $name . ' instanceof \think\Paginator ) && ' . $name . '->isEmpty()))): ?>' . $content . '<?php endif; ?>'; |
|
481 | + $parseStr = '<?php if(!(empty('.$name.') || (('.$name.' instanceof \think\Collection || '.$name.' instanceof \think\Paginator ) && '.$name.'->isEmpty()))): ?>'.$content.'<?php endif; ?>'; |
|
482 | 482 | |
483 | 483 | return $parseStr; |
484 | 484 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | public function tagDefined($tag, $content) |
495 | 495 | { |
496 | 496 | $name = $tag['name']; |
497 | - $parseStr = '<?php if(defined("' . $name . '")): ?>' . $content . '<?php endif; ?>'; |
|
497 | + $parseStr = '<?php if(defined("'.$name.'")): ?>'.$content.'<?php endif; ?>'; |
|
498 | 498 | |
499 | 499 | return $parseStr; |
500 | 500 | } |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | public function tagNotdefined($tag, $content) |
511 | 511 | { |
512 | 512 | $name = $tag['name']; |
513 | - $parseStr = '<?php if(!defined("' . $name . '")): ?>' . $content . '<?php endif; ?>'; |
|
513 | + $parseStr = '<?php if(!defined("'.$name.'")): ?>'.$content.'<?php endif; ?>'; |
|
514 | 514 | |
515 | 515 | return $parseStr; |
516 | 516 | } |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | if (isset($tag['value'])) { |
536 | 536 | $name = $tag['value']; |
537 | 537 | $name = $this->autoBuildVar($name); |
538 | - $name = 'isset(' . $name . ')'; |
|
539 | - $parseStr .= '<?php if(' . $name . '): ?>'; |
|
538 | + $name = 'isset('.$name.')'; |
|
539 | + $parseStr .= '<?php if('.$name.'): ?>'; |
|
540 | 540 | $endStr = '<?php endif; ?>'; |
541 | 541 | } |
542 | 542 | |
@@ -547,18 +547,18 @@ discard block |
||
547 | 547 | $type = strtolower(substr(strrchr($val, '.'), 1)); |
548 | 548 | switch ($type) { |
549 | 549 | case 'js': |
550 | - $parseStr .= '<script type="text/javascript" src="' . $val . '"></script>'; |
|
550 | + $parseStr .= '<script type="text/javascript" src="'.$val.'"></script>'; |
|
551 | 551 | break; |
552 | 552 | case 'css': |
553 | - $parseStr .= '<link rel="stylesheet" type="text/css" href="' . $val . '" />'; |
|
553 | + $parseStr .= '<link rel="stylesheet" type="text/css" href="'.$val.'" />'; |
|
554 | 554 | break; |
555 | 555 | case 'php': |
556 | - $parseStr .= '<?php include "' . $val . '"; ?>'; |
|
556 | + $parseStr .= '<?php include "'.$val.'"; ?>'; |
|
557 | 557 | break; |
558 | 558 | } |
559 | 559 | } |
560 | 560 | |
561 | - return $parseStr . $endStr; |
|
561 | + return $parseStr.$endStr; |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | /** |
@@ -578,10 +578,10 @@ discard block |
||
578 | 578 | if ('$' == $flag || ':' == $flag) { |
579 | 579 | $value = $this->autoBuildVar($tag['value']); |
580 | 580 | } else { |
581 | - $value = '\'' . $tag['value'] . '\''; |
|
581 | + $value = '\''.$tag['value'].'\''; |
|
582 | 582 | } |
583 | 583 | |
584 | - $parseStr = '<?php ' . $name . ' = ' . $value . '; ?>'; |
|
584 | + $parseStr = '<?php '.$name.' = '.$value.'; ?>'; |
|
585 | 585 | |
586 | 586 | return $parseStr; |
587 | 587 | } |
@@ -597,16 +597,16 @@ discard block |
||
597 | 597 | */ |
598 | 598 | public function tagDefine($tag, $content) |
599 | 599 | { |
600 | - $name = '\'' . $tag['name'] . '\''; |
|
600 | + $name = '\''.$tag['name'].'\''; |
|
601 | 601 | $flag = substr($tag['value'], 0, 1); |
602 | 602 | |
603 | 603 | if ('$' == $flag || ':' == $flag) { |
604 | 604 | $value = $this->autoBuildVar($tag['value']); |
605 | 605 | } else { |
606 | - $value = '\'' . $tag['value'] . '\''; |
|
606 | + $value = '\''.$tag['value'].'\''; |
|
607 | 607 | } |
608 | 608 | |
609 | - $parseStr = '<?php define(' . $name . ', ' . $value . '); ?>'; |
|
609 | + $parseStr = '<?php define('.$name.', '.$value.'); ?>'; |
|
610 | 610 | |
611 | 611 | return $parseStr; |
612 | 612 | } |
@@ -659,8 +659,8 @@ discard block |
||
659 | 659 | } |
660 | 660 | } |
661 | 661 | |
662 | - $parseStr = '<?php $__FOR_START_' . $rand . '__=' . $start . ';$__FOR_END_' . $rand . '__=' . $end . ';'; |
|
663 | - $parseStr .= 'for($' . $name . '=$__FOR_START_' . $rand . '__;' . $this->parseCondition('$' . $name . ' ' . $comparison . ' $__FOR_END_' . $rand . '__') . ';$' . $name . '+=' . $step . '){ ?>'; |
|
662 | + $parseStr = '<?php $__FOR_START_'.$rand.'__='.$start.';$__FOR_END_'.$rand.'__='.$end.';'; |
|
663 | + $parseStr .= 'for($'.$name.'=$__FOR_START_'.$rand.'__;'.$this->parseCondition('$'.$name.' '.$comparison.' $__FOR_END_'.$rand.'__').';$'.$name.'+='.$step.'){ ?>'; |
|
664 | 664 | $parseStr .= $content; |
665 | 665 | $parseStr .= '<?php } ?>'; |
666 | 666 | |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | $suffix = isset($tag['suffix']) ? $tag['suffix'] : 'true'; |
683 | 683 | $domain = isset($tag['domain']) ? $tag['domain'] : 'false'; |
684 | 684 | |
685 | - return '<?php echo url("' . $url . '","' . $vars . '",' . $suffix . ',' . $domain . ');?>'; |
|
685 | + return '<?php echo url("'.$url.'","'.$vars.'",'.$suffix.','.$domain.');?>'; |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | /** |
@@ -707,17 +707,17 @@ discard block |
||
707 | 707 | $name = !empty($tag['name']) ? $tag['name'] : 'func'; |
708 | 708 | $vars = !empty($tag['vars']) ? $tag['vars'] : ''; |
709 | 709 | $call = !empty($tag['call']) ? $tag['call'] : ''; |
710 | - $use = ['&$' . $name]; |
|
710 | + $use = ['&$'.$name]; |
|
711 | 711 | |
712 | 712 | if (!empty($tag['use'])) { |
713 | 713 | foreach (explode(',', $tag['use']) as $val) { |
714 | - $use[] = '&' . ltrim(trim($val), '&'); |
|
714 | + $use[] = '&'.ltrim(trim($val), '&'); |
|
715 | 715 | } |
716 | 716 | } |
717 | 717 | |
718 | - $parseStr = '<?php $' . $name . '=function(' . $vars . ') use(' . implode(',', $use) . ') {'; |
|
719 | - $parseStr .= ' ?>' . $content . '<?php }; '; |
|
720 | - $parseStr .= $call ? '$' . $name . '(' . $call . '); ?>' : '?>'; |
|
718 | + $parseStr = '<?php $'.$name.'=function('.$vars.') use('.implode(',', $use).') {'; |
|
719 | + $parseStr .= ' ?>'.$content.'<?php }; '; |
|
720 | + $parseStr .= $call ? '$'.$name.'('.$call.'); ?>' : '?>'; |
|
721 | 721 | |
722 | 722 | return $parseStr; |
723 | 723 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | // 生成模板缓存文件 |
37 | 37 | if (false === file_put_contents($cacheFile, $content)) { |
38 | - throw new Exception('cache write error:' . $cacheFile, 11602); |
|
38 | + throw new Exception('cache write error:'.$cacheFile, 11602); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 |
@@ -87,16 +87,16 @@ discard block |
||
87 | 87 | public function parseTag(&$content, $lib = '') |
88 | 88 | { |
89 | 89 | $tags = []; |
90 | - $lib = $lib ? strtolower($lib) . ':' : ''; |
|
90 | + $lib = $lib ? strtolower($lib).':' : ''; |
|
91 | 91 | |
92 | 92 | foreach ($this->tags as $name => $val) { |
93 | 93 | $close = !isset($val['close']) || $val['close'] ? 1 : 0; |
94 | - $tags[$close][$lib . $name] = $name; |
|
94 | + $tags[$close][$lib.$name] = $name; |
|
95 | 95 | if (isset($val['alias'])) { |
96 | 96 | // 别名设置 |
97 | 97 | $array = (array) $val['alias']; |
98 | 98 | foreach (explode(',', $array[0]) as $v) { |
99 | - $tags[$close][$lib . $v] = $name; |
|
99 | + $tags[$close][$lib.$v] = $name; |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | foreach ($nodes as $pos => $node) { |
137 | 137 | // 对应的标签名 |
138 | 138 | $name = $tags[1][$node['name']]; |
139 | - $alias = $lib . $name != $node['name'] ? ($lib ? strstr($node['name'], $lib) : $node['name']) : ''; |
|
139 | + $alias = $lib.$name != $node['name'] ? ($lib ? strstr($node['name'], $lib) : $node['name']) : ''; |
|
140 | 140 | |
141 | 141 | // 解析标签属性 |
142 | 142 | $attrs = $this->parseAttr($node['begin'][0], $name, $alias); |
143 | - $method = 'tag' . $name; |
|
143 | + $method = 'tag'.$name; |
|
144 | 144 | |
145 | 145 | // 读取标签库中对应的标签内容 replace[0]用来替换标签头,replace[1]用来替换标签尾 |
146 | 146 | $replace = explode($break, $this->$method($attrs, $break)); |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | // 自闭合标签 |
176 | 176 | if (!empty($tags[0])) { |
177 | 177 | $regex = $this->getRegex(array_keys($tags[0]), 0); |
178 | - $content = preg_replace_callback($regex, function ($matches) use (&$tags, &$lib) { |
|
178 | + $content = preg_replace_callback($regex, function($matches) use (&$tags, &$lib) { |
|
179 | 179 | // 对应的标签名 |
180 | 180 | $name = $tags[0][strtolower($matches[1])]; |
181 | - $alias = $lib . $name != $matches[1] ? ($lib ? strstr($matches[1], $lib) : $matches[1]) : ''; |
|
181 | + $alias = $lib.$name != $matches[1] ? ($lib ? strstr($matches[1], $lib) : $matches[1]) : ''; |
|
182 | 182 | // 解析标签属性 |
183 | 183 | $attrs = $this->parseAttr($matches[0], $name, $alias); |
184 | - $method = 'tag' . $name; |
|
184 | + $method = 'tag'.$name; |
|
185 | 185 | return $this->$method($attrs, ''); |
186 | 186 | }, $content); |
187 | 187 | } |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | if ($single) { |
207 | 207 | if ($close) { |
208 | 208 | // 如果是闭合标签 |
209 | - $regex = $begin . '(?:(' . $tagName . ')\b(?>[^' . $end . ']*)|\/(' . $tagName . '))' . $end; |
|
209 | + $regex = $begin.'(?:('.$tagName.')\b(?>[^'.$end.']*)|\/('.$tagName.'))'.$end; |
|
210 | 210 | } else { |
211 | - $regex = $begin . '(' . $tagName . ')\b(?>[^' . $end . ']*)' . $end; |
|
211 | + $regex = $begin.'('.$tagName.')\b(?>[^'.$end.']*)'.$end; |
|
212 | 212 | } |
213 | 213 | } else { |
214 | 214 | if ($close) { |
215 | 215 | // 如果是闭合标签 |
216 | - $regex = $begin . '(?:(' . $tagName . ')\b(?>(?:(?!' . $end . ').)*)|\/(' . $tagName . '))' . $end; |
|
216 | + $regex = $begin.'(?:('.$tagName.')\b(?>(?:(?!'.$end.').)*)|\/('.$tagName.'))'.$end; |
|
217 | 217 | } else { |
218 | - $regex = $begin . '(' . $tagName . ')\b(?>(?:(?!' . $end . ').)*)' . $end; |
|
218 | + $regex = $begin.'('.$tagName.')\b(?>(?:(?!'.$end.').)*)'.$end; |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | - return '/' . $regex . '/is'; |
|
222 | + return '/'.$regex.'/is'; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $must = explode(',', $tag['must']); |
267 | 267 | foreach ($must as $name) { |
268 | 268 | if (!isset($result[$name])) { |
269 | - throw new Exception('tag attr must:' . $name); |
|
269 | + throw new Exception('tag attr must:'.$name); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | if (!empty($this->tags[$name]['expression'])) { |
276 | 276 | static $_taglibs; |
277 | 277 | if (!isset($_taglibs[$name])) { |
278 | - $_taglibs[$name][0] = strlen($this->tpl->config('taglib_begin_origin') . $name); |
|
278 | + $_taglibs[$name][0] = strlen($this->tpl->config('taglib_begin_origin').$name); |
|
279 | 279 | $_taglibs[$name][1] = strlen($this->tpl->config('taglib_end_origin')); |
280 | 280 | } |
281 | 281 | $result['expression'] = substr($str, $_taglibs[$name][0], -$_taglibs[$name][1]); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $result['expression'] = rtrim($result['expression'], '/'); |
284 | 284 | $result['expression'] = trim($result['expression']); |
285 | 285 | } elseif (empty($this->tags[$name]) || !empty($this->tags[$name]['attr'])) { |
286 | - throw new Exception('tag error:' . $name); |
|
286 | + throw new Exception('tag error:'.$name); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | public function parseCondition($condition) |
300 | 300 | { |
301 | 301 | if (!strpos($condition, '::') && strpos($condition, ':')) { |
302 | - $condition = ' ' . substr(strstr($condition, ':'), 1); |
|
302 | + $condition = ' '.substr(strstr($condition, ':'), 1); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | $condition = str_ireplace(array_keys($this->comparison), array_values($this->comparison), $condition); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | |
332 | 332 | // 不以$开头并且也不是常量,自动补上$前缀 |
333 | - $name = '$' . $name; |
|
333 | + $name = '$'.$name; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | $this->tpl->parseVar($name); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if (isset($this->config[$middleware])) { |
155 | 155 | $middleware = $this->config[$middleware]; |
156 | 156 | } else { |
157 | - $middleware = $this->config['default_namespace'] . $middleware; |
|
157 | + $middleware = $this->config['default_namespace'].$middleware; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | protected function resolve($type = 'route') |
173 | 173 | { |
174 | - return function (Request $request) use ($type) { |
|
174 | + return function(Request $request) use ($type) { |
|
175 | 175 | |
176 | 176 | $middleware = array_shift($this->queue[$type]); |
177 | 177 |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | return call_user_func_array($this->hook[$method], $args); |
332 | 332 | } |
333 | 333 | |
334 | - throw new Exception('method not exists:' . static::class . '->' . $method); |
|
334 | + throw new Exception('method not exists:'.static::class.'->'.$method); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | |
386 | 386 | if (isset($info['port'])) { |
387 | 387 | $server['SERVER_PORT'] = $info['port']; |
388 | - $server['HTTP_HOST'] = $server['HTTP_HOST'] . ':' . $info['port']; |
|
388 | + $server['HTTP_HOST'] = $server['HTTP_HOST'].':'.$info['port']; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | if (isset($info['user'])) { |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $options['get'] = isset($options['get']) ? array_merge($get, $options['get']) : $get; |
424 | 424 | } |
425 | 425 | |
426 | - $server['REQUEST_URI'] = $info['path'] . ('' !== $queryString ? '?' . $queryString : ''); |
|
426 | + $server['REQUEST_URI'] = $info['path'].('' !== $queryString ? '?'.$queryString : ''); |
|
427 | 427 | $server['QUERY_STRING'] = $queryString; |
428 | 428 | $options['cookie'] = $cookie; |
429 | 429 | $options['param'] = $params; |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $options['baseUrl'] = $info['path']; |
434 | 434 | $options['pathinfo'] = '/' == $info['path'] ? '/' : ltrim($info['path'], '/'); |
435 | 435 | $options['method'] = $server['REQUEST_METHOD']; |
436 | - $options['domain'] = isset($info['scheme']) ? $info['scheme'] . '://' . $server['HTTP_HOST'] : ''; |
|
436 | + $options['domain'] = isset($info['scheme']) ? $info['scheme'].'://'.$server['HTTP_HOST'] : ''; |
|
437 | 437 | $options['content'] = $content; |
438 | 438 | |
439 | 439 | $request = new static(); |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | */ |
455 | 455 | public function domain($port = false) |
456 | 456 | { |
457 | - return $this->scheme() . '://' . $this->host($port); |
|
457 | + return $this->scheme().'://'.$this->host($port); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | if (!$root) { |
470 | 470 | $item = explode('.', $this->host(true)); |
471 | 471 | $count = count($item); |
472 | - $root = $count > 1 ? $item[$count - 2] . '.' . $item[$count - 1] : $item[0]; |
|
472 | + $root = $count > 1 ? $item[$count - 2].'.'.$item[$count - 1] : $item[0]; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | return $root; |
@@ -549,13 +549,13 @@ discard block |
||
549 | 549 | } elseif ($this->server('REQUEST_URI')) { |
550 | 550 | $this->url = $this->server('REQUEST_URI'); |
551 | 551 | } elseif ($this->server('ORIG_PATH_INFO')) { |
552 | - $this->url = $this->server('ORIG_PATH_INFO') . (!empty($this->server('QUERY_STRING')) ? '?' . $this->server('QUERY_STRING') : ''); |
|
552 | + $this->url = $this->server('ORIG_PATH_INFO').(!empty($this->server('QUERY_STRING')) ? '?'.$this->server('QUERY_STRING') : ''); |
|
553 | 553 | } else { |
554 | 554 | $this->url = ''; |
555 | 555 | } |
556 | 556 | } |
557 | 557 | |
558 | - return $complete ? $this->domain() . $this->url : $this->url; |
|
558 | + return $complete ? $this->domain().$this->url : $this->url; |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | /** |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | $this->baseUrl = strpos($str, '?') ? strstr($str, '?', true) : $str; |
584 | 584 | } |
585 | 585 | |
586 | - return $domain ? $this->domain() . $this->baseUrl : $this->baseUrl; |
|
586 | + return $domain ? $this->domain().$this->baseUrl : $this->baseUrl; |
|
587 | 587 | } |
588 | 588 | |
589 | 589 | /** |
@@ -604,8 +604,8 @@ discard block |
||
604 | 604 | $url = $this->server('PHP_SELF'); |
605 | 605 | } elseif (basename($this->server('ORIG_SCRIPT_NAME')) === $script_name) { |
606 | 606 | $url = $this->server('ORIG_SCRIPT_NAME'); |
607 | - } elseif (($pos = strpos($this->server('PHP_SELF'), '/' . $script_name)) !== false) { |
|
608 | - $url = substr($this->server('SCRIPT_NAME'), 0, $pos) . '/' . $script_name; |
|
607 | + } elseif (($pos = strpos($this->server('PHP_SELF'), '/'.$script_name)) !== false) { |
|
608 | + $url = substr($this->server('SCRIPT_NAME'), 0, $pos).'/'.$script_name; |
|
609 | 609 | } elseif ($this->server('DOCUMENT_ROOT') && strpos($this->server('SCRIPT_FILENAME'), $this->server('DOCUMENT_ROOT')) === 0) { |
610 | 610 | $url = str_replace('\\', '/', str_replace($this->server('DOCUMENT_ROOT'), '', $this->server('SCRIPT_FILENAME'))); |
611 | 611 | } |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | $this->baseFile = $url; |
614 | 614 | } |
615 | 615 | |
616 | - return $domain ? $this->domain() . $this->baseFile : $this->baseFile; |
|
616 | + return $domain ? $this->domain().$this->baseFile : $this->baseFile; |
|
617 | 617 | } |
618 | 618 | |
619 | 619 | /** |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | $this->root = rtrim($file, '/'); |
645 | 645 | } |
646 | 646 | |
647 | - return $domain ? $this->domain() . $this->root : $this->root; |
|
647 | + return $domain ? $this->domain().$this->root : $this->root; |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | /** |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | $root = strpos($base, '.') ? ltrim(dirname($base), DIRECTORY_SEPARATOR) : $base; |
659 | 659 | |
660 | 660 | if ('' != $root) { |
661 | - $root = '/' . ltrim($root, '/'); |
|
661 | + $root = '/'.ltrim($root, '/'); |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | return $root; |
@@ -724,10 +724,10 @@ discard block |
||
724 | 724 | $this->path = $pathinfo; |
725 | 725 | } elseif ($suffix) { |
726 | 726 | // 去除正常的URL后缀 |
727 | - $this->path = preg_replace('/\.(' . ltrim($suffix, '.') . ')$/i', '', $pathinfo); |
|
727 | + $this->path = preg_replace('/\.('.ltrim($suffix, '.').')$/i', '', $pathinfo); |
|
728 | 728 | } else { |
729 | 729 | // 允许任何后缀访问 |
730 | - $this->path = preg_replace('/\.' . $this->ext() . '$/i', '', $pathinfo); |
|
730 | + $this->path = preg_replace('/\.'.$this->ext().'$/i', '', $pathinfo); |
|
731 | 731 | } |
732 | 732 | } |
733 | 733 | |
@@ -1513,7 +1513,7 @@ discard block |
||
1513 | 1513 | if (is_scalar($data)) { |
1514 | 1514 | $data = (string) $data; |
1515 | 1515 | } else { |
1516 | - throw new \InvalidArgumentException('variable type error:' . gettype($data)); |
|
1516 | + throw new \InvalidArgumentException('variable type error:'.gettype($data)); |
|
1517 | 1517 | } |
1518 | 1518 | break; |
1519 | 1519 | } |
@@ -2028,7 +2028,7 @@ discard block |
||
2028 | 2028 | $token = call_user_func($type, $this->server('REQUEST_TIME_FLOAT')); |
2029 | 2029 | |
2030 | 2030 | if ($this->isAjax()) { |
2031 | - header($name . ': ' . $token); |
|
2031 | + header($name.': '.$token); |
|
2032 | 2032 | } |
2033 | 2033 | |
2034 | 2034 | facade\Session::set($name, $token); |
@@ -2083,12 +2083,12 @@ discard block |
||
2083 | 2083 | if (false !== strpos($key, ':')) { |
2084 | 2084 | $param = $this->param(); |
2085 | 2085 | foreach ($param as $item => $val) { |
2086 | - if (is_string($val) && false !== strpos($key, ':' . $item)) { |
|
2087 | - $key = str_replace(':' . $item, $val, $key); |
|
2086 | + if (is_string($val) && false !== strpos($key, ':'.$item)) { |
|
2087 | + $key = str_replace(':'.$item, $val, $key); |
|
2088 | 2088 | } |
2089 | 2089 | } |
2090 | 2090 | } elseif (strpos($key, ']')) { |
2091 | - if ('[' . $this->ext() . ']' == $key) { |
|
2091 | + if ('['.$this->ext().']' == $key) { |
|
2092 | 2092 | // 缓存某个后缀的请求 |
2093 | 2093 | $key = md5($this->url()); |
2094 | 2094 | } else { |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $this->handler = new \Redis; |
50 | 50 | |
51 | 51 | if ($this->options['persistent']) { |
52 | - $this->handler->pconnect($this->options['host'], $this->options['port'], $this->options['timeout'], 'persistent_id_' . $this->options['select']); |
|
52 | + $this->handler->pconnect($this->options['host'], $this->options['port'], $this->options['timeout'], 'persistent_id_'.$this->options['select']); |
|
53 | 53 | } else { |
54 | 54 | $this->handler->connect($this->options['host'], $this->options['port'], $this->options['timeout']); |
55 | 55 | } |
@@ -187,8 +187,7 @@ discard block |
||
187 | 187 | $key = $this->getCacheKey($name); |
188 | 188 | |
189 | 189 | return false === $ttl ? |
190 | - $this->handler->delete($key) : |
|
191 | - $this->handler->delete($key, $ttl); |
|
190 | + $this->handler->delete($key) : $this->handler->delete($key, $ttl); |
|
192 | 191 | } |
193 | 192 | |
194 | 193 | /** |
@@ -237,7 +236,7 @@ discard block |
||
237 | 236 | } |
238 | 237 | |
239 | 238 | foreach ($keys as $key) { |
240 | - $this->handler->append($tagName, ',' . $key); |
|
239 | + $this->handler->append($tagName, ','.$key); |
|
241 | 240 | } |
242 | 241 | } |
243 | 242 | |
@@ -256,7 +255,7 @@ discard block |
||
256 | 255 | $tagName = $this->getTagKey($this->tag); |
257 | 256 | |
258 | 257 | if ($this->handler->has($tagName)) { |
259 | - $this->handler->append($tagName, ',' . $name); |
|
258 | + $this->handler->append($tagName, ','.$name); |
|
260 | 259 | } else { |
261 | 260 | $this->handler->set($tagName, $name); |
262 | 261 | } |