Test Setup Failed
Push — master ( 38e597...1750e6 )
by Php Easy Api
05:49
created
src/resta/Support/Generator.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      * Generator constructor.
36 36
      * @param null $path
37 37
      */
38
-    public function __construct($path=null)
38
+    public function __construct($path = null)
39 39
     {
40 40
         $this->path = $path;
41 41
 
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function createPath()
55 55
     {
56
-        if(!file_exists($this->path)){
57
-            if(!files()->makeDirectory($this->path)){
56
+        if (!file_exists($this->path)) {
57
+            if (!files()->makeDirectory($this->path)) {
58 58
                 exception()->runtime($this->path.' makeDirectory fail');
59 59
             }
60 60
         }
@@ -68,18 +68,18 @@  discard block
 block discarded – undo
68 68
      *
69 69
      * @throws FileNotFoundException
70 70
      */
71
-    public function createFile($name=null,$replacement=array())
71
+    public function createFile($name = null, $replacement = array())
72 72
     {
73
-        if(file_exists($this->path) && !is_null($name)){
73
+        if (file_exists($this->path) && !is_null($name)) {
74 74
 
75 75
             $content = files()->get($this->getStubFile());
76 76
 
77 77
             $file = $this->path.''.DIRECTORY_SEPARATOR.''.ucfirst($name).'.php';
78 78
 
79
-            if(files()->put($file,$content)!==FALSE){
79
+            if (files()->put($file, $content)!==FALSE) {
80 80
 
81 81
                 $this->name = $name;
82
-                $this->replaceFileContent($replacement,$file);
82
+                $this->replaceFileContent($replacement, $file);
83 83
             }
84 84
         }
85 85
     }
@@ -103,17 +103,17 @@  discard block
 block discarded – undo
103 103
      *
104 104
      * @throws FileNotFoundException
105 105
      */
106
-    private function replaceFileContent($replacement,$file)
106
+    private function replaceFileContent($replacement, $file)
107 107
     {
108 108
         $replacementVariables = $this->replacementVariables($replacement);
109 109
         $content = files()->get($file);
110 110
 
111
-        foreach ($replacementVariables as $key=>$replacementVariable){
111
+        foreach ($replacementVariables as $key=>$replacementVariable) {
112 112
             $search = '/__'.$key.'__/';
113 113
             $replace = $replacementVariable;
114
-            $content = preg_replace($search,$replace,$content);
114
+            $content = preg_replace($search, $replace, $content);
115 115
         }
116
-        files()->replace($file,$content);
116
+        files()->replace($file, $content);
117 117
     }
118 118
 
119 119
     /**
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
      * @param array $replacement
123 123
      * @return array
124 124
      */
125
-    private function replacementVariables($replacement=array())
125
+    private function replacementVariables($replacement = array())
126 126
     {
127 127
         $replacement['namespace'] = $this->namespace;
128 128
         $replacement['class'] = $this->name;
129 129
 
130
-        return array_map(function($item){
130
+        return array_map(function($item) {
131 131
             return ucfirst($item);
132 132
         },$replacement);
133 133
     }
Please login to merge, or discard this patch.