Passed
Branch develop (bbcdb6)
by Prateek
07:38
created
src/Generators/Backend/Notification.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 class Notification extends BaseGenerator implements GeneratorInterface
10 10
 {
11 11
     private static $destination = "laragen/app/Notifications";
12
-    private static $namespace  = "Laragen\App\Notifications";
12
+    private static $namespace = "Laragen\App\Notifications";
13 13
     private static $template = "backend/notifications/notification";
14 14
 
15 15
     public function generate()
Please login to merge, or discard this patch.
src/Generators/Backend/Request.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 class Request extends BaseGenerator implements GeneratorInterface
8 8
 {
9 9
     private static $destination = "laragen/app/Http/Requests/Backend";
10
-    private static $namespace  = "Laragen\App\Http\Requests\Backend";
11
-    private static $template  = "backend/Request";
10
+    private static $namespace = "Laragen\App\Http\Requests\Backend";
11
+    private static $template = "backend/Request";
12 12
 
13 13
     private static $childDestination = "app/Http/Requests/Backend";
14
-    private static $childNamespace  = "App\Http\Requests\Backend";
15
-    private static $childTemplate  = "backend/EmptyClass";
14
+    private static $childNamespace = "App\Http\Requests\Backend";
15
+    private static $childTemplate = "backend/EmptyClass";
16 16
 
17 17
     public function generate()
18 18
     {
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         $childTemplate = $this->buildTemplate(self::$childTemplate, [
30 30
             '{{namespace}}'          => self::$childNamespace,
31 31
             '{{className}}'          => $this->module->getModelName()."Request",
32
-            '{{extendsClass}}'       => self::$namespace . '\\' . $this->module->getModelName()."Request"
32
+            '{{extendsClass}}'       => self::$namespace.'\\'.$this->module->getModelName()."Request"
33 33
         ]);
34 34
 
35 35
         $fullFilePath = $this->getPath(self::$destination."/").$this->module->getModelName()."Request".".php";
Please login to merge, or discard this patch.
src/Generators/Backend/Controller.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 class Controller extends BaseGenerator implements GeneratorInterface
8 8
 {
9 9
     private static $destination = "laragen/app/Http/Controllers/Backend";
10
-    private static $namespace  = "Laragen\App\Http\Controllers\Backend";
11
-    private static $template  = "backend/Controller";
10
+    private static $namespace = "Laragen\App\Http\Controllers\Backend";
11
+    private static $template = "backend/Controller";
12 12
 
13 13
     private static $childDestination = "app/Http/Controllers/Backend";
14
-    private static $childNamespace  = "App\Http\Controllers\Backend";
15
-    private static $childTemplate  = "backend/EmptyClass";
14
+    private static $childNamespace = "App\Http\Controllers\Backend";
15
+    private static $childTemplate = "backend/EmptyClass";
16 16
 
17 17
     public function generate()
18 18
     {
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $childTemplate = $this->buildTemplate(self::$childTemplate, [
34 34
             '{{namespace}}'          => self::$childNamespace,
35 35
             '{{className}}'          => $this->module->getModelName()."Controller",
36
-            '{{extendsClass}}'       => self::$namespace . '\\' . $this->module->getModelName()."Controller"
36
+            '{{extendsClass}}'       => self::$namespace.'\\'.$this->module->getModelName()."Controller"
37 37
         ]);
38 38
 
39 39
 
Please login to merge, or discard this patch.
src/Generators/Common/Model.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@
 block discarded – undo
8 8
 class Model extends BaseGenerator implements GeneratorInterface
9 9
 {
10 10
     protected $destination = "laragen/app/Models";
11
-    protected $namespace  = "Laragen\App\Models";
11
+    protected $namespace = "Laragen\App\Models";
12 12
     protected $template = "common/Models/Model";
13 13
     protected $pivotTemplate = "common/Models/Pivot";
14 14
 
15 15
     protected $childDestination = "app/Models";
16
-    protected $childNamespace  = "App\Models";
16
+    protected $childNamespace = "App\Models";
17 17
 
18 18
     public function generate()
19 19
     {
Please login to merge, or discard this patch.
src/Generators/Common/Seeder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -210,7 +210,7 @@
 block discarded – undo
210 210
             $this->insertIntoFile(
211 211
                 $laragenSeederFile,
212 212
                 "\n        // End factories",
213
-                "\n".$this->getTabs(2)."factory(".$type->getPivot()."::class, " . ((int) config('laragen.options.seed_rows') * 2) . ")->create();",
213
+                "\n".$this->getTabs(2)."factory(".$type->getPivot()."::class, ".((int) config('laragen.options.seed_rows') * 2).")->create();",
214 214
                 false
215 215
             );
216 216
         }
Please login to merge, or discard this patch.
src/Generators/BaseGenerator.php 1 patch
Spacing   +17 added lines, -18 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      *
46 46
      * @var string
47 47
      */
48
-    protected $childTemplate  = "backend/EmptyClass";
48
+    protected $childTemplate = "backend/EmptyClass";
49 49
 
50 50
     /**
51 51
      * Option to check if generator requires a separate child class file to be generated
@@ -84,12 +84,11 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function getStub($stubPath)
86 86
     {
87
-        $customThemeStub = base_path('laragen/stubs/' . $stubPath.".stub");
87
+        $customThemeStub = base_path('laragen/stubs/'.$stubPath.".stub");
88 88
 
89 89
         // Set stub file to the one from custom folder i.e laragen/stubs if it exists, else use default from laragen package
90 90
         $stubFilePath = file_exists($customThemeStub) ?
91
-            base_path('laragen/stubs/' . $stubPath.".stub") :
92
-            realpath(__DIR__."/../resources/stubs"). "/$stubPath.stub";
91
+            base_path('laragen/stubs/'.$stubPath.".stub") : realpath(__DIR__."/../resources/stubs")."/$stubPath.stub";
93 92
 
94 93
         return $this->getFileContents($stubFilePath);
95 94
     }
@@ -112,7 +111,7 @@  discard block
 block discarded – undo
112 111
      * @param string $filePath absolute path of file to be read
113 112
      * @return string contents of the file
114 113
      */
115
-    public function getFileContents($filePath){
114
+    public function getFileContents($filePath) {
116 115
         return $this->sanitize(file_get_contents($filePath));
117 116
     }
118 117
 
@@ -142,7 +141,7 @@  discard block
 block discarded – undo
142 141
      */
143 142
     public function getFilePath($fileName = null)
144 143
     {
145
-        return $this->getPath($this->destination."/") . ($fileName ?? $this->module->getModelName()) . $this->fileSuffix . "." . $this->fileExtension;
144
+        return $this->getPath($this->destination."/").($fileName ?? $this->module->getModelName()).$this->fileSuffix.".".$this->fileExtension;
146 145
     }
147 146
 
148 147
     /**
@@ -155,7 +154,7 @@  discard block
 block discarded – undo
155 154
      */
156 155
     public function getChildClassFilePath($fileName = null)
157 156
     {
158
-        return $this->getPath($this->childDestination."/") . ($fileName ?? $this->module->getModelName()) . $this->fileSuffix . "." . $this->fileExtension;
157
+        return $this->getPath($this->childDestination."/").($fileName ?? $this->module->getModelName()).$this->fileSuffix.".".$this->fileExtension;
159 158
     }
160 159
 
161 160
     /**
@@ -171,13 +170,13 @@  discard block
 block discarded – undo
171 170
         $this->fileSystem->dumpFile($file, $content);
172 171
 
173 172
         // Check if a child should be generated as in regular laravel file structure
174
-        if($this->needsChildGeneration()){
173
+        if ($this->needsChildGeneration()) {
175 174
             $childFile = $this->getChildClassFilePath($filename);
176
-            if(!file_exists($childFile)){
175
+            if (!file_exists($childFile)) {
177 176
                 $childFileContent = $this->buildTemplate($this->childTemplate, [
178 177
                     '{{namespace}}'          => $this->childNamespace,
179 178
                     '{{className}}'          => $this->module->getModelName(),
180
-                    '{{extendsClass}}'       => $this->namespace . '\\' . $this->module->getModelName()
179
+                    '{{extendsClass}}'       => $this->namespace.'\\'.$this->module->getModelName()
181 180
                 ]);
182 181
                 $this->fileSystem->dumpFile($childFile, $childFileContent);
183 182
             }
@@ -193,7 +192,7 @@  discard block
 block discarded – undo
193 192
      *
194 193
      * @return boolean
195 194
      */
196
-    public function needsChildGeneration(){
195
+    public function needsChildGeneration() {
197 196
         return $this->needsChildGeneration;
198 197
     }
199 198
 
@@ -205,16 +204,16 @@  discard block
 block discarded – undo
205 204
      * @return void
206 205
      */
207 206
     public function deleteFiles($target) {
208
-        if(is_dir($target)){
209
-            $files = glob( $target . '*', GLOB_MARK );
207
+        if (is_dir($target)) {
208
+            $files = glob($target.'*', GLOB_MARK);
210 209
 
211
-            foreach( $files as $file ){
212
-                $this->deleteFiles( $file );
210
+            foreach ($files as $file) {
211
+                $this->deleteFiles($file);
213 212
             }
214 213
 
215
-            rmdir( $target );
216
-        } elseif(is_file($target)) {
217
-            unlink( $target );
214
+            rmdir($target);
215
+        } elseif (is_file($target)) {
216
+            unlink($target);
218 217
         }
219 218
     }
220 219
 
Please login to merge, or discard this patch.
src/Models/Types/LaragenType.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $filteredTypes = [];
79 79
         $options = is_array($options) ? $options : [$options];
80
-        foreach($this->getPivotColumns() as $type){
80
+        foreach ($this->getPivotColumns() as $type) {
81 81
             foreach ($options as $option) {
82
-                if($type->$option()){
82
+                if ($type->$option()) {
83 83
                     $filteredTypes[] = $columnsOnly ? $type->getColumn() : $type;
84 84
                     break;
85 85
                 }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
     public function getForeignKey()
118 118
     {
119
-        return $this->columnName . "_id";
119
+        return $this->columnName."_id";
120 120
     }
121 121
 
122 122
     public function getRelatedModel()
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
     public function getChildModel()
138 138
     {
139
-        return ucfirst(Str::camel(Str::singular($this->typeOption ?? $this->columnName )));
139
+        return ucfirst(Str::camel(Str::singular($this->typeOption ?? $this->columnName)));
140 140
     }
141 141
 
142 142
     public function getParentModel()
Please login to merge, or discard this patch.
src/Models/LaragenOptions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,10 +45,10 @@
 block discarded – undo
45 45
     }
46 46
 
47 47
     public function getModule($name) {
48
-        if(isset($this->modules[$name]))
48
+        if (isset($this->modules[$name]))
49 49
             return $this->modules[$name];
50 50
         else
51
-            throw new \Exception("Module '". $name. "' not found");
51
+            throw new \Exception("Module '".$name."' not found");
52 52
     }
53 53
 
54 54
     protected function getModulesRecursive($moduleName, $moduleData) {
Please login to merge, or discard this patch.
src/resources/database/migrations/2019_01_01_000000_alter_users_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@
 block discarded – undo
8 8
 {
9 9
     public function up()
10 10
     {
11
-        Schema::table('users', function (Blueprint $table) {
11
+        Schema::table('users', function(Blueprint $table) {
12 12
             $table->string('api_token', 60)->unique()->nullable();
13 13
         });
14 14
     }
15 15
 
16 16
     public function down()
17 17
     {
18
-        Schema::table('users', function (Blueprint $table) {
18
+        Schema::table('users', function(Blueprint $table) {
19 19
             $table->dropColumn(['api_token']);
20 20
         });
21 21
     }
Please login to merge, or discard this patch.