Passed
Push — master ( af0465...9c82b2 )
by Prateek
06:01 queued 02:59
created
src/Generators/BaseGenerator.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
     }
52 52
 
53 53
     public function initializeFile($fullFilePath, $stub, $initializeWithText = false) {
54
-        if(file_exists($fullFilePath)){
54
+        if (file_exists($fullFilePath)) {
55 55
             $this->fileSystem->remove($fullFilePath);
56 56
         }
57
-        $seederTemplate = ($initializeWithText===false) ? $this->buildTemplate($stub) : $initializeWithText;
57
+        $seederTemplate = ($initializeWithText === false) ? $this->buildTemplate($stub) : $initializeWithText;
58 58
         $this->fileSystem->dumpFile($fullFilePath, $seederTemplate);
59 59
         return $fullFilePath;
60 60
     }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     }
77 77
 
78 78
     public function insertIntoFile($file_path, $insert_marker, $text, $after = true) {
79
-        $contents = str_replace("\r",'', file_get_contents($file_path));
79
+        $contents = str_replace("\r", '', file_get_contents($file_path));
80 80
         $new_contents = ($after) ? str_replace($insert_marker, $insert_marker.$text, $contents) : str_replace($insert_marker, $text.$insert_marker, $contents); 
81 81
         $this->fileSystem->dumpFile($file_path, $new_contents);
82 82
     }
Please login to merge, or discard this patch.
src/Models/FileSystem.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@
 block discarded – undo
12 12
 
13 13
 		if (is_dir($src)) {
14 14
 			$this->mirror($src, $dest."/".basename($src));
15
-		}else{
15
+		} else {
16 16
 			$this->copy($src, $dest);
17 17
 		}
18 18
 	}
19 19
 
20
-	public function getFullSourcePath($path){
21
-		return realpath(__DIR__ . "/../resources/" . $path);
20
+	public function getFullSourcePath($path) {
21
+		return realpath(__DIR__."/../resources/".$path);
22 22
 	}
23 23
 }
Please login to merge, or discard this patch.
src/Commands/Generate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
         }
74 74
     }
75 75
 
76
-    protected function configToGenerators($array){
76
+    protected function configToGenerators($array) {
77 77
         $generators = [];
78 78
         foreach ($array as $ns => $items) {
79 79
             foreach ($items as $item) {
Please login to merge, or discard this patch.
src/Generators/Backend/Request.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
         return $fullFilePath;
20 20
 	}
21 21
 	
22
-	protected function getRules(){
22
+	protected function getRules() {
23 23
 		// Todo
24 24
 		return "";
25 25
 	}
Please login to merge, or discard this patch.
src/Models/Module.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
         $data = ['S.N.'];
35 35
         foreach ($this->data as $column => $optionString) {
36 36
             $optionArray = explode(':', $optionString);
37
-            if (in_array($optionArray[0], ['string', 'int'])&&in_array($column, ['title', 'firstname', 'lastname', 'name'])) {
37
+            if (in_array($optionArray[0], ['string', 'int']) && in_array($column, ['title', 'firstname', 'lastname', 'name'])) {
38 38
                 $data[] = ucwords($column);
39 39
             }
40 40
         }
Please login to merge, or discard this patch.
src/Generators/Frontend/View.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,23 +12,23 @@
 block discarded – undo
12 12
 
13 13
         $generatedFiles = [];
14 14
         foreach ($viewsToBeGenerated as $view) {
15
-            $viewTemplate = $this->buildTemplate('frontend/views/' . $view, [
15
+            $viewTemplate = $this->buildTemplate('frontend/views/'.$view, [
16 16
                 '{{modelNameSingularLowercase}}' => $this->module->getModelNameSingularLowercase(),
17 17
                 '{{modelNamePlural}}'            => $this->module->getModelNamePlural(),
18 18
                 '{{moduleName}}'                 => $this->module->getModuleName()
19 19
             ]);
20 20
 
21
-            $fullFilePath = $this->getPath("resources/views/" . $this->module->getModuleName()) . "/{$view}.blade.php";
21
+            $fullFilePath = $this->getPath("resources/views/".$this->module->getModuleName())."/{$view}.blade.php";
22 22
             file_put_contents($fullFilePath, $viewTemplate);
23
-            $generatedFiles[] =  $fullFilePath;
23
+            $generatedFiles[] = $fullFilePath;
24 24
         }
25 25
 
26
-        $layoutPath = $this->getPath("resources/views/laragen/layouts/") . "app.blade.php";
27
-        if(!file_exists($layoutPath)){
26
+        $layoutPath = $this->getPath("resources/views/laragen/layouts/")."app.blade.php";
27
+        if (!file_exists($layoutPath)) {
28 28
 
29 29
             $viewTemplate = $this->buildTemplate('views/layouts/app', []);
30 30
             file_put_contents($layoutPath, $viewTemplate);
31
-            $generatedFiles[] =  $layoutPath;
31
+            $generatedFiles[] = $layoutPath;
32 32
         }
33 33
 
34 34
         return $generatedFiles;
Please login to merge, or discard this patch.
src/Generators/Backend/View.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,20 +16,20 @@  discard block
 block discarded – undo
16 16
 		$generatedFiles = [];
17 17
 		
18 18
         foreach ($viewsToBeGenerated as $view) {
19
-            $viewTemplate = $this->buildTemplate('backend/views/' . $view, [
19
+            $viewTemplate = $this->buildTemplate('backend/views/'.$view, [
20 20
 				'{{headings}}' 			 => $this->getHeadings(),
21 21
                 '{{modelNameLowercase}}' => str_singular($this->module->getModuleName()),
22 22
                 '{{moduleName}}'         => $this->module->getModuleName()
23 23
             ]);
24 24
 
25
-            $fullFilePath = $this->getPath("resources/views/backend/" . $this->module->getModuleName()) . "/{$view}.blade.php";
25
+            $fullFilePath = $this->getPath("resources/views/backend/".$this->module->getModuleName())."/{$view}.blade.php";
26 26
             file_put_contents($fullFilePath, $viewTemplate);
27
-            $generatedFiles[] =  $fullFilePath;
27
+            $generatedFiles[] = $fullFilePath;
28 28
         }
29 29
 
30 30
         $mainMenuFile = $this->getPath("resources/views/backend/includes/")."main_menu.blade.php";
31 31
 
32
-        if(self::$initializeFlag++ == 0){
32
+        if (self::$initializeFlag++ == 0) {
33 33
             $this->initializeFiles([
34 34
                 $mainMenuFile => "backend/views/includes/main_menu",
35 35
             ]);
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
         return $generatedFiles;
45 45
 	}
46 46
 
47
-	public function getHeadings(){
47
+	public function getHeadings() {
48 48
         $columns = $this->module->getBackendColumnTitles();
49
-        $headings= "";
49
+        $headings = "";
50 50
         foreach ($columns as $column) {
51 51
             $headings .= "<th>".$column."</th>";
52 52
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $viewTemplate = '';
68 68
 
69 69
         foreach ($this->module->getNativeData() as $columns) {
70
-            foreach($columns as $column => $type){
70
+            foreach ($columns as $column => $type) {
71 71
                 $viewTemplate .= $this->buildTemplate('backend/views/formelements/'.$keyToFile[$type], [
72 72
                     '{{columnName}}'                 => $column,
73 73
                     '{{modelNameLowercase}}'         => strtolower($this->module->getModelName()),
@@ -88,20 +88,20 @@  discard block
 block discarded – undo
88 88
             '{{createElements}}'             => $viewTemplate,
89 89
         ]);
90 90
         
91
-        $editFilePath = $this->getPath("resources/views/backend/" . $this->module->getModuleName()) . "/edit.blade.php";
91
+        $editFilePath = $this->getPath("resources/views/backend/".$this->module->getModuleName())."/edit.blade.php";
92 92
         file_put_contents($editFilePath, $editTemplate);
93 93
         
94 94
         
95
-        $createFilePath = $this->getPath("resources/views/backend/" . $this->module->getModuleName()) . "/create.blade.php";
95
+        $createFilePath = $this->getPath("resources/views/backend/".$this->module->getModuleName())."/create.blade.php";
96 96
         file_put_contents($createFilePath, $createTemplate);
97 97
         
98
-        $formFilePath = $this->getPath("resources/views/backend/" . $this->module->getModuleName()) . "/_form.blade.php";
98
+        $formFilePath = $this->getPath("resources/views/backend/".$this->module->getModuleName())."/_form.blade.php";
99 99
         file_put_contents($formFilePath, $formTemplate);
100 100
 
101 101
 
102
-        $generatedFiles[] =  $createFilePath;
103
-        $generatedFiles[] =  $formFilePath;
104
-        $generatedFiles[] =  $editFilePath;
102
+        $generatedFiles[] = $createFilePath;
103
+        $generatedFiles[] = $formFilePath;
104
+        $generatedFiles[] = $editFilePath;
105 105
 
106 106
         return $generatedFiles;
107 107
 
Please login to merge, or discard this patch.
src/Generators/Common/Route.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         $webRouteFile = $this->getPath("routes/frontend/")."web.php";
18 18
         $backendWebRouteFile = $this->getPath("routes/backend/")."web.php";
19 19
 
20
-        if(self::$initializeFlag++ == 0){
20
+        if (self::$initializeFlag++ == 0) {
21 21
             $this->initializeFiles([
22 22
                 $webRouteFile => "Route",
23 23
                 $backendAuthRouteFile => "backend/routes/auth",
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
         $this->insertIntoFile(
45 45
             $webRouteFile,
46
-            "/" . "* Insert your routes here */",
46
+            "/"."* Insert your routes here */",
47 47
             "\n".$this->getTabs(1)."Route::resource('".$this->module->getModuleName()."', ".$this->module->getModelName()."Controller::class);"
48 48
         );
49 49
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
         $this->insertIntoFile(
59 59
             $backendWebRouteFile,
60
-            "/" . "* Insert your routes here */",
60
+            "/"."* Insert your routes here */",
61 61
             "\n".$this->getTabs(1)."Route::resource('".$this->module->getModuleName()."', ".$this->module->getModelName()."Controller::class);"
62 62
         );
63 63
         
Please login to merge, or discard this patch.
src/Generators/Common/Seeder.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         file_put_contents($fullFilePath, $factoryTemplate);
24 24
         $generatedFiles[] = $fullFilePath;
25 25
         
26
-        $laragenSeederFile = (self::$initializeFlag++ == 0) ? $this->initializeFile($this->getPath("database/seeds/")."LaragenSeeder.php", 'common/Seeder') :  $this->getPath("database/seeds/")."LaragenSeeder.php";
26
+        $laragenSeederFile = (self::$initializeFlag++ == 0) ? $this->initializeFile($this->getPath("database/seeds/")."LaragenSeeder.php", 'common/Seeder') : $this->getPath("database/seeds/")."LaragenSeeder.php";
27 27
 
28 28
         $this->insertIntoFile(
29 29
             $laragenSeederFile,
@@ -93,23 +93,23 @@  discard block
 block discarded – undo
93 93
 
94 94
         $dataDefinition = "";
95 95
         foreach ($this->module->getNativeData() as $columns) {
96
-            foreach($columns as $column => $type){
96
+            foreach ($columns as $column => $type) {
97 97
                 $specialTypes = array_keys($specialTypesToDefinition);
98
-                if(in_array($column,$specialTypes)){
99
-                    $dataDefinition .= $this->getTabs(2) . "'{$column}'" . " => " . '$faker->' . $specialTypesToDefinition[$column];
100
-                } else{
101
-                    $dataDefinition .= $this->getTabs(2) . "'{$column}'" . " => " . '$faker->' . $typeToDefinition[$type];
98
+                if (in_array($column, $specialTypes)) {
99
+                    $dataDefinition .= $this->getTabs(2)."'{$column}'"." => ".'$faker->'.$specialTypesToDefinition[$column];
100
+                } else {
101
+                    $dataDefinition .= $this->getTabs(2)."'{$column}'"." => ".'$faker->'.$typeToDefinition[$type];
102 102
                 }
103 103
 
104
-                if($column != last($columns)) {
105
-                    $dataDefinition .= "," . PHP_EOL;
104
+                if ($column != last($columns)) {
105
+                    $dataDefinition .= ",".PHP_EOL;
106 106
                 }
107 107
             }
108 108
         }
109 109
         return $dataDefinition;
110 110
     }
111 111
 
112
-    protected function getForeignData(){
112
+    protected function getForeignData() {
113 113
         $columns = $this->module->getForeignColumns('parent');
114 114
 
115 115
         $foreignData = "";
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
                     '{{parentModel}}' => ucfirst(camel_case(str_singular($parent)))
122 122
                 ]);
123 123
                 
124
-                if($column != last($columns)) {
125
-                    $foreignData .= "," . PHP_EOL;
124
+                if ($column != last($columns)) {
125
+                    $foreignData .= ",".PHP_EOL;
126 126
                 }
127 127
             }
128 128
         }
Please login to merge, or discard this patch.