Passed
Push — master ( 8e4488...6a0d5f )
by 世昌
02:52
created
nebula/runnable/target/TargetBuilder.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         if ($fileStart === 0) {
48 48
             return new FileTarget(substr($command, 1));
49 49
         }
50
-        $requireFile = substr($command, $fileStart+1);
50
+        $requireFile = substr($command, $fileStart + 1);
51 51
         $command = substr($command, 0, $fileStart);
52 52
         // for parameter list
53 53
         list($command, $parameter) = self::splitParameter($command);
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
         $dynmicsMethod;
59 59
         $parameter = self::buildParameter($parameter);
60 60
         if ($methodStart > 0) {
61
-            $splitLength = $splitLength > 0 ? 1:2;
61
+            $splitLength = $splitLength > 0 ? 1 : 2;
62 62
             $methodName = substr($command, $methodStart + $splitLength);
63 63
             $command = substr($command, 0, $methodStart);
64 64
             list($className, $constructParameter) = self::splitParameter($command);
65 65
             $constructParameter = self::buildParameter($constructParameter);
66
-            $target = new MethodTarget($className, $dynmicsMethod? $constructParameter :null, $methodName, $parameter);
66
+            $target = new MethodTarget($className, $dynmicsMethod ? $constructParameter : null, $methodName, $parameter);
67 67
         } else {
68 68
             $target = new FunctionTarget(self::buildName($command), $parameter);
69 69
         }
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
         if (is_null($parameter)) {
81 81
             return new  $classRelName;
82 82
         }
83
-        $parameters=self::buildParameter($parameter);
84
-        $classRef= new ReflectionClass($classRelName);
83
+        $parameters = self::buildParameter($parameter);
84
+        $classRef = new ReflectionClass($classRelName);
85 85
         return $classRef->newInstanceArgs($parameters);
86 86
     }
87 87
 
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
         if (preg_match('/^[\w\\\\\/.]+$/', $name) !== 1) {
91 91
             throw new \Exception(\sprintf('invaild command name: %s ', $name));
92 92
         }
93
-        return  str_replace(['.','/'], '\\', $name);
93
+        return  str_replace(['.', '/'], '\\', $name);
94 94
     }
95 95
 
96 96
     private static function splitParameter(string $command):array
97 97
     {
98 98
         $parameter = null;
99
-        if (strrpos($command, ')') === strlen($command) -1) {
99
+        if (strrpos($command, ')') === strlen($command) - 1) {
100 100
             $paramStart = strpos($command, '(');
101 101
             $parameter = substr($command, $paramStart + 1, strlen($command) - $paramStart - 2);
102 102
             $command = substr($command, 0, $paramStart);
103 103
         }
104
-        return [$command,$parameter];
104
+        return [$command, $parameter];
105 105
     }
106 106
 
107 107
     private static function buildParameter(?string $parameter)
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             if (strpos($value, ':') === 0) {
121 121
                 $value = base64_decode(substr($value, 1));
122 122
             }
123
-            if ($prefix ==='=j' || $prefix ==='=json') {
123
+            if ($prefix === '=j' || $prefix === '=json') {
124 124
                 $params = json_decode($value);
125 125
                 if (json_last_error() === JSON_ERROR_NONE) {
126 126
                     return $params;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         } else {
137 137
             $params = explode(',', trim($param, ','));
138 138
             foreach ($params as $index=>$value) {
139
-                $params[$index]=trim($value);
139
+                $params[$index] = trim($value);
140 140
             }
141 141
             return $params;
142 142
         }
Please login to merge, or discard this patch.
nebula/runnable/target/ClosureTarget.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
      */
18 18
     protected $closure;
19 19
     
20
-    public function __construct(Closure $closure, array $parameter =[]) {
20
+    public function __construct(Closure $closure, array $parameter = []) {
21 21
         $this->closure = $closure;
22 22
         $this->parameter = $parameter;
23 23
         $this->name = 'Closure object()';
Please login to merge, or discard this patch.
nebula/runnable/Runnable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * 可执行命令表达式
13 13
  *
14 14
  */
15
-class Runnable   {
15
+class Runnable {
16 16
 
17 17
     /**
18 18
      * 运行对象
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
      */
22 22
     protected $target;
23 23
 
24
-    public function __construct($runnable, array $parameter=[]) {
24
+    public function __construct($runnable, array $parameter = []) {
25 25
         $this->target = TargetBuilder::build($runnable, $parameter);
26 26
     }
27 27
 
Please login to merge, or discard this patch.