Passed
Push — master ( 6668a8...516163 )
by 世昌
02:16
created
nebula/loader/IncludeManager.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,14 +15,14 @@  discard block
 block discarded – undo
15 15
      *
16 16
      * @var array
17 17
      */
18
-    protected $namespace=[ __NAMESPACE__ ];
18
+    protected $namespace = [__NAMESPACE__];
19 19
 
20 20
     /**
21 21
      * 包含路径
22 22
      *
23 23
      * @var array
24 24
      */
25
-    protected $includePath=[];
25
+    protected $includePath = [];
26 26
 
27 27
     /**
28 28
      * 将JAVA,路径分割转换为PHP分割符
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public static function realName(string $name):string
34 34
     {
35
-        return str_replace(['.','/'], '\\', $name);
35
+        return str_replace(['.', '/'], '\\', $name);
36 36
     }
37 37
 
38 38
     /**
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
      * @param string $name
42 42
      * @return string|null
43 43
      */
44
-    public static function realPath(string $name):?string
44
+    public static function realPath(string $name): ?string
45 45
     {
46 46
         $absulotePath = static::toAbsolutePath($name);
47
-        return file_exists($absulotePath)?$absulotePath:null;
47
+        return file_exists($absulotePath) ? $absulotePath : null;
48 48
     }
49 49
 
50 50
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      * @param string $filename
55 55
      * @return string|null
56 56
      */
57
-    public function import(string $filename):?string
57
+    public function import(string $filename): ?string
58 58
     {
59 59
         if ($filename = static::realPath($filename)) {
60 60
             @require_once $filename;
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
         return null;
71 71
     }
72 72
 
73
-    public function addIncludePath(string $path, string $namespace=null)
73
+    public function addIncludePath(string $path, string $namespace = null)
74 74
     {
75 75
         if ($path = static::realPath($path)) {
76 76
             $namespace = $namespace ?? 0;
77 77
             if (array_key_exists($namespace, $this->includePath)) {
78 78
                 if (!\in_array($path, $this->includePath[$namespace])) {
79
-                    $this->includePath[$namespace][]=$path;
79
+                    $this->includePath[$namespace][] = $path;
80 80
                 }
81 81
             } else {
82
-                $this->includePath[$namespace][]=$path;
82
+                $this->includePath[$namespace][] = $path;
83 83
             }
84 84
         }
85 85
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     public function setNamespace(string $namespace)
98 98
     {
99 99
         if (!in_array($namespace, $this->namespace)) {
100
-            $this->namespace[]=$namespace;
100
+            $this->namespace[] = $namespace;
101 101
         }
102 102
     }
103 103
 }
Please login to merge, or discard this patch.
nebula/loader/Loader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param string $className
57 57
      * @return string|null
58 58
      */
59
-    public  function getClassPath(string $className):?string
59
+    public  function getClassPath(string $className): ?string
60 60
     {
61 61
         // 搜索路径
62 62
         foreach ($this->includePath as $includeNamespace => $includePaths) {
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
      * @param string $className
79 79
      * @return string|null
80 80
      */
81
-    protected  function getClassPathByAlias(string $includePath, string $className):?string
81
+    protected  function getClassPathByAlias(string $includePath, string $className): ?string
82 82
     {
83
-        $namepath=static::formatSeparator($className);
84
-        $className=static::realName($className);
83
+        $namepath = static::formatSeparator($className);
84
+        $className = static::realName($className);
85 85
         foreach ($this->namespace as $namespace) {
86 86
             $path = $includePath.DIRECTORY_SEPARATOR.$namespace.DIRECTORY_SEPARATOR.$namepath.'.php';
87 87
             if ($path = static::realPath($path)) {
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
      * @param string $className
104 104
      * @return string|null
105 105
      */
106
-    protected  function getClassPathByName(string $includeNamespace, string $includePath, string $className):?string
106
+    protected  function getClassPathByName(string $includeNamespace, string $includePath, string $className): ?string
107 107
     {
108 108
         if (is_numeric($includeNamespace)) {
109 109
             $path = $includePath.DIRECTORY_SEPARATOR.static::formatSeparator($className).'.php';
110 110
         } else {
111 111
             $nl = strlen($includeNamespace);
112 112
             if (substr(static::realName($className), 0, $nl) === $includeNamespace) {
113
-                $path=$includePath.DIRECTORY_SEPARATOR.static::formatSeparator(substr($className, $nl)).'.php';
113
+                $path = $includePath.DIRECTORY_SEPARATOR.static::formatSeparator(substr($className, $nl)).'.php';
114 114
             } else {
115
-                $path=$includePath.DIRECTORY_SEPARATOR.static::formatSeparator($className).'.php';
115
+                $path = $includePath.DIRECTORY_SEPARATOR.static::formatSeparator($className).'.php';
116 116
             }
117 117
         }
118 118
         if ($path = static::realPath($path)) {
Please login to merge, or discard this patch.