Passed
Push — master ( 6a3c94...5b674e )
by Prateek
05:01 queued 02:58
created
config/laragen.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -1,58 +1,58 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-	'options' => [
5
-		'generated_by_default' => ['Migration', 'Controller', 'Model', 'View', 'Seeder'],
6
-		'skip_generators' => [],
7
-		'override' => true
8
-	],
9
-	'modules' => [
4
+    'options' => [
5
+        'generated_by_default' => ['Migration', 'Controller', 'Model', 'View', 'Seeder'],
6
+        'skip_generators' => [],
7
+        'override' => true
8
+    ],
9
+    'modules' => [
10 10
 		
11
-		// optional parameters : 
12
-		// 		'multiple'=>[]
13
-		// 		'images'=>'single'   	//Images type: single, multiple
11
+        // optional parameters : 
12
+        // 		'multiple'=>[]
13
+        // 		'images'=>'single'   	//Images type: single, multiple
14 14
 
15
-		'categories' => [
16
-			'data'=> [
17
-				// Separated by ':', numeric value represents size of the field its 192 by default and is optional
15
+        'categories' => [
16
+            'data'=> [
17
+                // Separated by ':', numeric value represents size of the field its 192 by default and is optional
18 18
 				
19
-				// Regular data types: 
20
-				// 		string, int, text, bool, date
19
+                // Regular data types: 
20
+                // 		string, int, text, bool, date
21 21
 				
22
-				// Data type modifiers 
23
-				// 		unique
22
+                // Data type modifiers 
23
+                // 		unique
24 24
 
25
-				//Must start with data type nd then followed by size, then by modifiers if required
25
+                //Must start with data type nd then followed by size, then by modifiers if required
26 26
 
27
-				// Special data types: 
28
-				// 		parent: requires name of a module, creates a one-to-many relation with the current module
29
-				// 		related: requires name of a module, creates many to many relation with current module
27
+                // Special data types: 
28
+                // 		parent: requires name of a module, creates a one-to-many relation with the current module
29
+                // 		related: requires name of a module, creates many to many relation with current module
30 30
 
31
-				'title' 			=> 'string:128',
32
-				'slug' 				=> 'string:128:unique',
33
-				'short_description' => 'string',
34
-			],
35
-			'images'=>'single'
36
-		],
31
+                'title' 			=> 'string:128',
32
+                'slug' 				=> 'string:128:unique',
33
+                'short_description' => 'string',
34
+            ],
35
+            'images'=>'single'
36
+        ],
37 37
 
38
-		'tags' => [
39
-			'data'=> [
40
-				'title' 			=> 'string:128'
41
-			]
42
-		],
38
+        'tags' => [
39
+            'data'=> [
40
+                'title' 			=> 'string:128'
41
+            ]
42
+        ],
43 43
 
44
-		'posts'	=> [
45
-			'data'	=> [
46
-				'author' 			=> 'parent:users',
47
-				'title' 			=> 'string:256',
48
-				'slug' 				=> 'string:128:unique',
49
-				'short_description' => 'string',
50
-				'full_description' 	=> 'text',
51
-				'category'			=> 'parent:categories',
52
-				'posted_at'			=> 'datetime',
53
-				'tags'				=> 'related:tags'
54
-			],
55
-			'images'=>'multiple'
56
-		],
57
-	]
44
+        'posts'	=> [
45
+            'data'	=> [
46
+                'author' 			=> 'parent:users',
47
+                'title' 			=> 'string:256',
48
+                'slug' 				=> 'string:128:unique',
49
+                'short_description' => 'string',
50
+                'full_description' 	=> 'text',
51
+                'category'			=> 'parent:categories',
52
+                'posted_at'			=> 'datetime',
53
+                'tags'				=> 'related:tags'
54
+            ],
55
+            'images'=>'multiple'
56
+        ],
57
+    ]
58 58
 ];
Please login to merge, or discard this patch.
src/Commands/Generate.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
                 $itemGenerator = new $generator($module);
48 48
                 $returnedFiles = $itemGenerator->generate();
49 49
                 
50
-                if(!is_array($returnedFiles)) 
50
+                if (!is_array($returnedFiles)) 
51 51
                     $generatedFiles[] = $returnedFiles;
52 52
                 else
53 53
                     $generatedFiles = array_merge($generatedFiles, $returnedFiles);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $this->line("\n");
62 62
         
63 63
         foreach ($generatedFiles as $file) {
64
-            $this->info("Generated file: " . str_replace(base_path() . "\\", "", $file));
64
+            $this->info("Generated file: ".str_replace(base_path()."\\", "", $file));
65 65
         }
66 66
     }
67 67
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,10 +47,11 @@
 block discarded – undo
47 47
                 $itemGenerator = new $generator($module);
48 48
                 $returnedFiles = $itemGenerator->generate();
49 49
                 
50
-                if(!is_array($returnedFiles)) 
51
-                    $generatedFiles[] = $returnedFiles;
52
-                else
53
-                    $generatedFiles = array_merge($generatedFiles, $returnedFiles);
50
+                if(!is_array($returnedFiles)) {
51
+                                    $generatedFiles[] = $returnedFiles;
52
+                } else {
53
+                                    $generatedFiles = array_merge($generatedFiles, $returnedFiles);
54
+                }
54 55
                 
55 56
                 $bar->advance();
56 57
             }
Please login to merge, or discard this patch.
src/Generators/Seeder.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -15,35 +15,35 @@  discard block
 block discarded – undo
15 15
             '{{dataDefinition}}' => $this->getDataDefinition(),
16 16
             '{{foreignData}}'    => $this->getForeignData()
17 17
         ]);
18
-        $fullFilePath = $this->getPath("database/factories/") . $this->module->getModelName() . "Factory.php";
18
+        $fullFilePath = $this->getPath("database/factories/").$this->module->getModelName()."Factory.php";
19 19
         file_put_contents($fullFilePath, $modelTemplate);
20
-        $generatedFiles[] =  $fullFilePath;
20
+        $generatedFiles[] = $fullFilePath;
21 21
         
22 22
         $modelTemplate = $this->buildTemplate('Seeder', [
23 23
             '{{modelName}}'  => $this->module->getModelName(),
24 24
             '{{usedModels}}' => $this->getUsedModels()
25 25
         ]);
26
-        $fullFilePath = $this->getPath("database/seeds/") . $this->module->getModelName() . "Seeder.php";
26
+        $fullFilePath = $this->getPath("database/seeds/").$this->module->getModelName()."Seeder.php";
27 27
         file_put_contents($fullFilePath, $modelTemplate);
28
-        $generatedFiles[] =  $fullFilePath;
28
+        $generatedFiles[] = $fullFilePath;
29 29
         
30 30
         return $generatedFiles;         
31 31
     }
32 32
 
33
-    protected function getUsedModels(){
33
+    protected function getUsedModels() {
34 34
         $foreignModels = $this->module->getForeignColumns();
35 35
         $namespace = "App\\Models\\";
36
-        $usedModels = "use " . $namespace . $this->module->getModelName() . ";";
36
+        $usedModels = "use ".$namespace.$this->module->getModelName().";";
37 37
 
38 38
         foreach ($foreignModels as $models) {
39
-            foreach($models as $column => $module){
40
-                $usedModels .= PHP_EOL . "use " . $namespace . $this->moduleToModelName($module) . ";";
39
+            foreach ($models as $column => $module) {
40
+                $usedModels .= PHP_EOL."use ".$namespace.$this->moduleToModelName($module).";";
41 41
             }
42 42
         }
43 43
         return $usedModels;
44 44
     }
45 45
 
46
-    protected function getDataDefinition(){
46
+    protected function getDataDefinition() {
47 47
         $typeToDefinition = [];
48 48
 
49 49
         $specialTypesToDefinition = [
@@ -80,22 +80,22 @@  discard block
 block discarded – undo
80 80
 
81 81
         $dataDefinition = "";
82 82
         foreach ($this->module->getNativeData() as $columns) {
83
-            foreach($columns as $column => $type){
83
+            foreach ($columns as $column => $type) {
84 84
                 $specialTypes = array_keys($specialTypesToDefinition);
85
-                if(in_array($column,$specialTypes)){
86
-                    $dataDefinition .= $this->getTabs(2) . "'{$column}'" . " => " . '$faker->' . $specialTypesToDefinition[$column];
87
-                }else{
88
-                    $dataDefinition .= $this->getTabs(2) . "'{$column}'" . " => " . '$faker->' . $typeToDefinition[$type];
85
+                if (in_array($column, $specialTypes)) {
86
+                    $dataDefinition .= $this->getTabs(2)."'{$column}'"." => ".'$faker->'.$specialTypesToDefinition[$column];
87
+                } else {
88
+                    $dataDefinition .= $this->getTabs(2)."'{$column}'"." => ".'$faker->'.$typeToDefinition[$type];
89 89
                 }
90 90
 
91
-                if($column != last($columns))
92
-                    $dataDefinition .= "," . PHP_EOL;
91
+                if ($column != last($columns))
92
+                    $dataDefinition .= ",".PHP_EOL;
93 93
             }
94 94
         }
95 95
         return $dataDefinition;
96 96
     }
97 97
 
98
-    protected function getForeignData(){
98
+    protected function getForeignData() {
99 99
         $columns = $this->module->getForeignColumns('parent');
100 100
 
101 101
         $foreignData = "";
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
                     '{{parentModel}}' => ucfirst(camel_case(str_singular($parent)))
108 108
                 ]);
109 109
                 
110
-                if($column != last($columns))
111
-                    $foreignData .= "," . PHP_EOL;
110
+                if ($column != last($columns))
111
+                    $foreignData .= ",".PHP_EOL;
112 112
             }
113 113
         }
114 114
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -84,12 +84,13 @@  discard block
 block discarded – undo
84 84
                 $specialTypes = array_keys($specialTypesToDefinition);
85 85
                 if(in_array($column,$specialTypes)){
86 86
                     $dataDefinition .= $this->getTabs(2) . "'{$column}'" . " => " . '$faker->' . $specialTypesToDefinition[$column];
87
-                }else{
87
+                } else{
88 88
                     $dataDefinition .= $this->getTabs(2) . "'{$column}'" . " => " . '$faker->' . $typeToDefinition[$type];
89 89
                 }
90 90
 
91
-                if($column != last($columns))
92
-                    $dataDefinition .= "," . PHP_EOL;
91
+                if($column != last($columns)) {
92
+                                    $dataDefinition .= "," . PHP_EOL;
93
+                }
93 94
             }
94 95
         }
95 96
         return $dataDefinition;
@@ -107,8 +108,9 @@  discard block
 block discarded – undo
107 108
                     '{{parentModel}}' => ucfirst(camel_case(str_singular($parent)))
108 109
                 ]);
109 110
                 
110
-                if($column != last($columns))
111
-                    $foreignData .= "," . PHP_EOL;
111
+                if($column != last($columns)) {
112
+                                    $foreignData .= "," . PHP_EOL;
113
+                }
112 114
             }
113 115
         }
114 116
 
Please login to merge, or discard this patch.
src/Generators/Migration.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
             '{{modelTableSchema}}'  => $this->getSchema()
19 19
         ]);
20 20
         
21
-        $fileCounter = (int)date('His') + ++self::$counter;
22
-        $filenamePrefix = date('Y_m_d_') . $fileCounter . "_";
23
-        $fileName = "create_" . $this->module->getModuleName() . "_table.php";
21
+        $fileCounter = (int) date('His') + ++self::$counter;
22
+        $filenamePrefix = date('Y_m_d_').$fileCounter."_";
23
+        $fileName = "create_".$this->module->getModuleName()."_table.php";
24 24
 
25 25
         $existingFiles = scandir(database_path("migrations"));
26 26
         
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
             }
31 31
         }
32 32
 
33
-        $fullFilePath = database_path("migrations\\") . $filenamePrefix . $fileName;  
33
+        $fullFilePath = database_path("migrations\\").$filenamePrefix.$fileName;  
34 34
         file_put_contents($fullFilePath, $migrationTemplate);
35 35
 
36 36
         return $fullFilePath;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
             $schema .= $option->getSchema();
49 49
 
50 50
             if ($column != $lastColumn) {
51
-                $schema .= PHP_EOL . $this->getTabs(3);
51
+                $schema .= PHP_EOL.$this->getTabs(3);
52 52
             }
53 53
         }
54 54
 
Please login to merge, or discard this patch.
src/Generators/View.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@
 block discarded – undo
11 11
 
12 12
         $generatedFiles = [];
13 13
         foreach ($viewsToBeGenerated as $view) {
14
-            $viewTemplate = $this->buildTemplate('Views/' . $view, [
14
+            $viewTemplate = $this->buildTemplate('Views/'.$view, [
15 15
                 '{{modelNameSingularLowercase}}' => $this->module->getModelNameSingularLowercase(),
16 16
                 '{{modelNamePlural}}'            => $this->module->getModelNamePlural(),
17 17
                 '{{moduleName}}'                 => $this->module->getModuleName()
18 18
             ]);
19 19
 
20
-            $fullFilePath = $this->getPath("resources/views/" . $this->module->getModuleName()) . "/{$view}.blade.php";
20
+            $fullFilePath = $this->getPath("resources/views/".$this->module->getModuleName())."/{$view}.blade.php";
21 21
             file_put_contents($fullFilePath, $viewTemplate);
22
-            $generatedFiles[] =  $fullFilePath;         
22
+            $generatedFiles[] = $fullFilePath;         
23 23
         }
24 24
         return $generatedFiles;
25 25
     }
Please login to merge, or discard this patch.
src/Generators/Model.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
14 14
             '{{foreignMethods}}'  => $this->getForeignMethods()
15 15
         ]);
16 16
         
17
-        $fullFilePath = $this->getPath("app/Models/") . $this->module->getModelName() . ".php";
17
+        $fullFilePath = $this->getPath("app/Models/").$this->module->getModelName().".php";
18 18
         file_put_contents($fullFilePath, $modelTemplate);
19 19
         return $fullFilePath;
20 20
     }
21 21
 
22 22
     protected function getMassAssignables()
23 23
     {
24
-        return "'" . implode("', '", $this->module->getNativeColumns()) . "'";
24
+        return "'".implode("', '", $this->module->getNativeColumns())."'";
25 25
     }
26 26
 
27 27
     protected function getForeignMethods()
Please login to merge, or discard this patch.
src/Generators/Controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
             '{{modelNameSingularLowerCase}}' => strtolower($this->module->getModelName())
14 14
         ]);
15 15
         
16
-        $fullFilePath = $this->getPath("app/Http/Controllers/") . $this->module->getModelName() . "Controller" . ".php";
16
+        $fullFilePath = $this->getPath("app/Http/Controllers/").$this->module->getModelName()."Controller".".php";
17 17
         file_put_contents($fullFilePath, $controllerTemplate);
18 18
         return $fullFilePath;
19 19
     }
Please login to merge, or discard this patch.
src/Models/Module.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
     public function __construct($module)
16 16
     {
17
-        $this->module = (object)$module;
17
+        $this->module = (object) $module;
18 18
         $this->data   = $this->module->data;
19 19
         $this->name   = $this->module->name;
20 20
     }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     public function getForeignColumns($type = 'all')
57 57
     {
58
-        if(is_array($type))
58
+        if (is_array($type))
59 59
             $types = $type;
60 60
         else
61 61
             $types = ($type == "all") ? ['parent', 'related'] : [$type];
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,10 +55,11 @@
 block discarded – undo
55 55
 
56 56
     public function getForeignColumns($type = 'all')
57 57
     {
58
-        if(is_array($type))
59
-            $types = $type;
60
-        else
61
-            $types = ($type == "all") ? ['parent', 'related'] : [$type];
58
+        if(is_array($type)) {
59
+                    $types = $type;
60
+        } else {
61
+                    $types = ($type == "all") ? ['parent', 'related'] : [$type];
62
+        }
62 63
         
63 64
         $data = [];
64 65
         foreach ($this->data as $column => $optionString) {
Please login to merge, or discard this patch.