Passed
Push — master ( 28ea87...37d3cb )
by kill
02:19
created
core/helpers/Chaos.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
 	 * @param string $str
123 123
 	 */
124 124
 	function setPinyin($str) {
125
-		$py = mt_rand(0, iconv_strlen( $str, 'UTF-8' )-1);
126
-		$t_str = iconv_substr( $str, $py, 1, 'UTF-8');
127
-		if(mt_rand(0,10) > 5) {
128
-		    $pinyin = " ";
125
+		$py=mt_rand(0, iconv_strlen($str, 'UTF-8') - 1);
126
+		$t_str=iconv_substr($str, $py, 1, 'UTF-8');
127
+		if (mt_rand(0, 10) > 5) {
128
+		    $pinyin=" ";
129 129
 		}
130
-		$pinyin = $this->_pinyin->convert($t_str,PINYIN_UNICODE);
131
-        $pinyin=implode(" ",$pinyin);
132
-		if(mt_rand(0,10) > 5) {
133
-		    $pinyin .= " ";
130
+		$pinyin=$this->_pinyin->convert($t_str, PINYIN_UNICODE);
131
+        $pinyin=implode(" ", $pinyin);
132
+		if (mt_rand(0, 10) > 5) {
133
+		    $pinyin.=" ";
134 134
 		}
135
-		if($t_str != "%"){
136
-			$str = preg_replace("'$t_str'", $pinyin, $str, 1);
135
+		if ($t_str != "%") {
136
+			$str=preg_replace("'$t_str'", $pinyin, $str, 1);
137 137
 		}
138 138
 		return $str;
139 139
 	}
@@ -144,18 +144,18 @@  discard block
 block discarded – undo
144 144
 	 * @param string $str
145 145
 	 */
146 146
 	function setRepeat($str) {
147
-		$len = iconv_strlen( $str, 'UTF-8' );
148
-		$action = 0;
149
-		$temp = '';
150
-		for( $i=0;  $i<$len; $i++ ){
151
-			$t_str = iconv_substr( $str, $i, 1 ,'UTF-8');
152
-			if( mt_rand( 1, 50 ) > 48 && $action == 0) {
153
-				if(!preg_match("@[a-z0-9%\\s]+@i", $t_str)) {
154
-					$temp .= $t_str;
155
-					$action = 1;
147
+		$len=iconv_strlen($str, 'UTF-8');
148
+		$action=0;
149
+		$temp='';
150
+		for ($i=0; $i < $len; $i++) {
151
+			$t_str=iconv_substr($str, $i, 1, 'UTF-8');
152
+			if (mt_rand(1, 50) > 48 && $action == 0) {
153
+				if (!preg_match("@[a-z0-9%\\s]+@i", $t_str)) {
154
+					$temp.=$t_str;
155
+					$action=1;
156 156
 				}
157 157
 			}
158
-			$temp .= $t_str;
158
+			$temp.=$t_str;
159 159
 		}
160 160
 		return $temp;
161 161
 	}
Please login to merge, or discard this patch.
function.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 
408 408
     // 过滤查询特殊字符
409 409
     if (preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i', $value)) {
410
-        $value .= ' ';
410
+        $value.=' ';
411 411
     }
412 412
 }
413 413
 /**
@@ -415,15 +415,15 @@  discard block
 block discarded – undo
415 415
  *
416 416
  * @return string|null
417 417
  */
418
-function config($name=null,$value=null,$default=null){
418
+function config($name=null, $value=null, $default=null) {
419 419
     $config=\puck\Conf::load();
420
-    if ($name===null){
420
+    if ($name === null) {
421 421
         return $config->all();
422 422
     }
423
-    if ($value===null){
424
-        return $config->get($name,$default);
423
+    if ($value === null) {
424
+        return $config->get($name, $default);
425 425
     }
426
-    $config->set($name,$value);
426
+    $config->set($name, $value);
427 427
 }
428 428
 /**
429 429
  * 字符串命名风格转换
@@ -440,14 +440,14 @@  discard block
 block discarded – undo
440 440
     }
441 441
 }
442 442
 
443
-if (! function_exists('app')) {
443
+if (!function_exists('app')) {
444 444
     /**
445 445
      * Get the available container instance.
446 446
      *
447 447
      * @param  string  $make
448 448
      * @return mixed|\Laravel\Lumen\Application
449 449
      */
450
-    function app($make = null)
450
+    function app($make=null)
451 451
     {
452 452
         if (is_null($make)) {
453 453
             return Container::getInstance();
Please login to merge, or discard this patch.
core/App.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@
 block discarded – undo
17 17
      */
18 18
     private function initContainer() {
19 19
         static::setInstance($this);
20
-        $this->instance('app',$this);
21
-        $this->bind('pinyin','\puck\helpers\PinYin');
20
+        $this->instance('app', $this);
21
+        $this->bind('pinyin', '\puck\helpers\PinYin');
22 22
     }
23 23
 
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.