Passed
Push — master ( fa7991...10a1b7 )
by 世昌
02:08
created
nebula/runnable/target/MethodTarget.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
      * @param string $method
40 40
      * @param array $parameter
41 41
      */
42
-    public function __construct($object, ?array $constructParameter=null, string $method, array $parameter = [])
42
+    public function __construct($object, ?array $constructParameter = null, string $method, array $parameter = [])
43 43
     {
44 44
         $this->object = $object;
45 45
         $this->constructParameter = $constructParameter;
46 46
         $this->method = $method;
47 47
         $this->parameter = $parameter;
48 48
         $static = $this->isStatic() ? '->' : '::';
49
-        $name = \is_object($object)? \get_class($object) : $object;
49
+        $name = \is_object($object) ? \get_class($object) : $object;
50 50
         $this->name = $name.$static.$method;
51 51
     }
52 52
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         if (!is_null($this->requireFile) && !\class_exists($this->object)) {
59 59
             require_once $this->requireFile;
60 60
         }
61
-        $classRef= new ReflectionClass($this->object);
61
+        $classRef = new ReflectionClass($this->object);
62 62
         return $classRef->newInstanceArgs($this->constructParameter);
63 63
     }
64 64
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             if ($this->isStatic() || \is_object($this->object)) {
69 69
                 $this->runableTarget = [$this->object, $this->method];
70 70
             }
71
-            $this->runableTarget =  [$this->getObjectInstance(), $this->method];
71
+            $this->runableTarget = [$this->getObjectInstance(), $this->method];
72 72
         }
73 73
         return $this->runableTarget;
74 74
     }
Please login to merge, or discard this patch.
nebula/runnable/target/TargetBuilder.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         $fileStart = \strrpos($command, '@');
23 23
         // for @file
24 24
         if ($fileStart > 0) {
25
-            $requireFile = substr($command, $fileStart+1);
25
+            $requireFile = substr($command, $fileStart + 1);
26 26
             $command = substr($command, 0, $fileStart);
27 27
         }
28 28
         if ($fileStart === 0) {
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
         $dynmicsMethod;
38 38
         $parameter = self::buildParameter($parameter);
39 39
         if ($methodStart > 0) {
40
-            $splitLength = $splitLength > 0 ? 1:2;
40
+            $splitLength = $splitLength > 0 ? 1 : 2;
41 41
             $methodName = substr($command, $methodStart + $splitLength);
42 42
             $command = substr($command, 0, $methodStart);
43 43
             list($className, $constructParameter) = self::splitParameter($command);
44 44
             $constructParameter = self::buildParameter($constructParameter);
45
-            return new MethodTarget($className, $dynmicsMethod? $constructParameter :null, $methodName, $parameter);
45
+            return new MethodTarget($className, $dynmicsMethod ? $constructParameter : null, $methodName, $parameter);
46 46
         } else {
47 47
             return new FunctionTarget(self::buildName($command), $parameter);
48 48
         }
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
         if (preg_match('/^[\w\\\\\/.]+$/', $name) !== 1) {
54 54
             throw new \Exception(__('invaild command name: $0', $name));
55 55
         }
56
-        return  str_replace(['.','/'], '\\', $name);
56
+        return  str_replace(['.', '/'], '\\', $name);
57 57
     }
58 58
 
59 59
     private static function splitParameter(string $command):array
60 60
     {
61 61
         $parameter = null;
62
-        if (strrpos($command, ')') === strlen($command) -1) {
62
+        if (strrpos($command, ')') === strlen($command) - 1) {
63 63
             $paramStart = strpos($command, '(');
64 64
             $parameter = substr($command, $paramStart + 1, strlen($command) - $paramStart - 2);
65 65
             $command = substr($command, 0, $paramStart);
66 66
         }
67
-        return [$command,$parameter];
67
+        return [$command, $parameter];
68 68
     }
69 69
 
70 70
     private static function buildParameter(?string $parameter)
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             if (strpos($value, ':') === 0) {
84 84
                 $value = base64_decode(substr($value, 1));
85 85
             }
86
-            if ($prefix ==='=j' || $prefix ==='=json') {
86
+            if ($prefix === '=j' || $prefix === '=json') {
87 87
                 $params = json_decode($value);
88 88
                 if (json_last_error() === JSON_ERROR_NONE) {
89 89
                     return $params;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         } else {
100 100
             $params = explode(',', trim($param, ','));
101 101
             foreach ($params as $index=>$value) {
102
-                $params[$index]=trim($value);
102
+                $params[$index] = trim($value);
103 103
             }
104 104
             return $params;
105 105
         }
Please login to merge, or discard this patch.
nebula/runnable/target/RunnableTarget.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
  * 可执行命令表目标
6 6
  *
7 7
  */
8
-abstract class RunnableTarget  {
8
+abstract class RunnableTarget {
9 9
 
10 10
     /**
11 11
      * Get 可执行对象
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
     }
Please login to merge, or discard this patch.
nebula/runnable/target/FunctionTarget.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 $function;
19 19
  
20
-    public function __construct(string $name, array $parameter =[]) {
20
+    public function __construct(string $name, array $parameter = []) {
21 21
         $this->setParameter($parameter);
22 22
         $this->function = $name;
23 23
     }
Please login to merge, or discard this patch.
nebula/runnable/target/FileTarget.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
      *
16 16
      * @var string|null
17 17
      */
18
-    protected $requireFile=null;
18
+    protected $requireFile = null;
19 19
     
20
-    public function __construct(string $path, array $parameter =[]) {
20
+    public function __construct(string $path, array $parameter = []) {
21 21
         $this->setRequireFile($path);
22 22
         $this->setParameter($parameter);
23 23
     }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public function setRequireFile($requireFile)
48 48
     {
49 49
         $this->requireFile = $requireFile;
50
-        $this->name ='@'.$requireFile;
50
+        $this->name = '@'.$requireFile;
51 51
         return $this;
52 52
     }
53 53
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
             $args = $runnable->getParameter();
74 74
         }
75 75
         array_unshift($args, $this->requireFile);
76
-        $_SERVER['argv']=$args;
77
-        $_SERVER['args']=count($args);
76
+        $_SERVER['argv'] = $args;
77
+        $_SERVER['args'] = count($args);
78 78
         return include $requireFile;
79 79
     }
80 80
 }
Please login to merge, or discard this patch.
nebula/runnable/Runnable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,6 +5,6 @@
 block discarded – undo
5 5
  * 可执行命令表达式
6 6
  *
7 7
  */
8
-class Runnable  {
8
+class Runnable {
9 9
     
10 10
 }
11 11
\ No newline at end of file
Please login to merge, or discard this patch.