@@ -46,18 +46,18 @@ discard block |
||
46 | 46 | * @param string $method |
47 | 47 | * @param array $parameter |
48 | 48 | */ |
49 | - public function __construct($object, ?array $constructParameter=null, string $method, array $parameter = []) |
|
49 | + public function __construct($object, ?array $constructParameter = null, string $method, array $parameter = []) |
|
50 | 50 | { |
51 | 51 | $this->object = $object; |
52 | 52 | $this->constructParameter = $constructParameter; |
53 | 53 | $this->method = $method; |
54 | 54 | $this->parameter = $parameter; |
55 | 55 | $static = $this->isStatic() ? '->' : '::'; |
56 | - $name = \is_object($object)? \get_class($object) : $object; |
|
56 | + $name = \is_object($object) ? \get_class($object) : $object; |
|
57 | 57 | $this->name = $name.$static.$method; |
58 | 58 | } |
59 | 59 | |
60 | - public function getObjectInstance():?object |
|
60 | + public function getObjectInstance(): ?object |
|
61 | 61 | { |
62 | 62 | if (\is_object($this->object)) { |
63 | 63 | return $this->object; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if (!is_null($this->requireFile) && !\class_exists($this->object)) { |
69 | 69 | require_once $this->requireFile; |
70 | 70 | } |
71 | - $classRef= new ReflectionClass($this->object); |
|
71 | + $classRef = new ReflectionClass($this->object); |
|
72 | 72 | return $classRef->newInstanceArgs($this->constructParameter); |
73 | 73 | } |
74 | 74 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | if ($this->isStatic() || \is_object($this->object)) { |
79 | 79 | $this->runnableTarget = [$this->object, $this->method]; |
80 | 80 | } |
81 | - $this->runnableTarget = [$this->getObjectInstance() ?? $this->object, $this->method]; |
|
81 | + $this->runnableTarget = [$this->getObjectInstance() ?? $this->object, $this->method]; |
|
82 | 82 | } |
83 | 83 | return $this->runnableTarget; |
84 | 84 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | } |
51 | 51 | $requireFile = ''; |
52 | 52 | if ($fileStart > 0) { |
53 | - $requireFile = substr($command, $fileStart+1); |
|
53 | + $requireFile = substr($command, $fileStart + 1); |
|
54 | 54 | $command = substr($command, 0, $fileStart); |
55 | 55 | } |
56 | 56 | // for parameter list |
@@ -62,12 +62,12 @@ discard block |
||
62 | 62 | $dynmicsMethod; |
63 | 63 | $parameter = self::buildParameter($parameter); |
64 | 64 | if ($methodStart > 0) { |
65 | - $splitLength = $splitLength > 0 ? 1:2; |
|
65 | + $splitLength = $splitLength > 0 ? 1 : 2; |
|
66 | 66 | $methodName = substr($command, $methodStart + $splitLength); |
67 | 67 | $command = substr($command, 0, $methodStart); |
68 | 68 | list($className, $constructParameter) = self::splitParameter($command); |
69 | 69 | $constructParameter = self::buildParameter($constructParameter); |
70 | - $target = new MethodTarget($className, $dynmicsMethod? $constructParameter :null, $methodName, $parameter); |
|
70 | + $target = new MethodTarget($className, $dynmicsMethod ? $constructParameter : null, $methodName, $parameter); |
|
71 | 71 | } else { |
72 | 72 | $target = new FunctionTarget(self::buildName($command), $parameter); |
73 | 73 | } |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | if (is_null($parameter)) { |
85 | 85 | return new $classRelName; |
86 | 86 | } |
87 | - $parameters=self::buildParameter($parameter); |
|
88 | - $classRef= new ReflectionClass($classRelName); |
|
87 | + $parameters = self::buildParameter($parameter); |
|
88 | + $classRef = new ReflectionClass($classRelName); |
|
89 | 89 | return $classRef->newInstanceArgs($parameters); |
90 | 90 | } |
91 | 91 | |
@@ -94,18 +94,18 @@ discard block |
||
94 | 94 | if (preg_match('/^[\w\\\\\/.]+$/', $name) !== 1) { |
95 | 95 | throw new \Exception(\sprintf('invaild command name: %s ', $name)); |
96 | 96 | } |
97 | - return str_replace(['.','/'], '\\', $name); |
|
97 | + return str_replace(['.', '/'], '\\', $name); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | private static function splitParameter(string $command):array |
101 | 101 | { |
102 | 102 | $parameter = null; |
103 | - if (strrpos($command, ')') === strlen($command) -1) { |
|
103 | + if (strrpos($command, ')') === strlen($command) - 1) { |
|
104 | 104 | $paramStart = strpos($command, '('); |
105 | 105 | $parameter = substr($command, $paramStart + 1, strlen($command) - $paramStart - 2); |
106 | 106 | $command = substr($command, 0, $paramStart); |
107 | 107 | } |
108 | - return [$command,$parameter]; |
|
108 | + return [$command, $parameter]; |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | private static function buildParameter(?string $parameter) |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | if (strpos($value, ':') === 0) { |
125 | 125 | $value = base64_decode(substr($value, 1)); |
126 | 126 | } |
127 | - if ($prefix ==='=j' || $prefix ==='=json') { |
|
127 | + if ($prefix === '=j' || $prefix === '=json') { |
|
128 | 128 | $params = json_decode($value); |
129 | 129 | if (json_last_error() === JSON_ERROR_NONE) { |
130 | 130 | return $params; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } else { |
141 | 141 | $params = explode(',', trim($param, ',')); |
142 | 142 | foreach ($params as $index=>$value) { |
143 | - $params[$index]=trim($value); |
|
143 | + $params[$index] = trim($value); |
|
144 | 144 | } |
145 | 145 | return $params; |
146 | 146 | } |