Completed
Push — master ( 63d8d6...28be9d )
by Raphael
11:25
created
src/Scaffolder/Commands/GeneratorCommand.php 2 patches
Unused Use Statements   +1 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,11 +39,8 @@
 block discarded – undo
39 39
 use Scaffolder\Support\Json;
40 40
 use Scaffolder\Support\Arrays;
41 41
 use Scaffolder\Support\CamelCase;
42
-use Scaffolder\Themes\IScaffolderThemeLayouts;
43
-use Scaffolder\Themes\IScaffolderThemeViews;
44 42
 use Scaffolder\Compilers\Support\PathParser;
45
-
46
-use stdClass ;
43
+use stdClass;
47 44
 
48 45
 class GeneratorCommand extends Command
49 46
 {
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 use Scaffolder\Themes\IScaffolderThemeViews;
44 44
 use Scaffolder\Compilers\Support\PathParser;
45 45
 
46
-use stdClass ;
46
+use stdClass;
47 47
 
48 48
 class GeneratorCommand extends Command
49 49
 {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	{
58 58
 		parent::__construct();
59 59
 
60
-		$this->stubsDirectory = __DIR__ . '/../../../stubs/';
60
+		$this->stubsDirectory = __DIR__.'/../../../stubs/';
61 61
 	}
62 62
 
63 63
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	public function handle()
68 68
 	{
69 69
 		// check if is to clear cache
70
-		if($this->option('clear-all')){
70
+		if ($this->option('clear-all')) {
71 71
 			$this->call('scaffolder:clear');
72 72
 		}
73 73
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * API Generation command for API files.  
112 112
 	 * @return void
113 113
 	 */
114
-	private function handleApi(){
114
+	private function handleApi() {
115 115
 		// Get all the models
116 116
 		$modelsData = $this->getAllModelsData();
117 117
 
@@ -194,19 +194,19 @@  discard block
 block discarded – undo
194 194
 		$this->comment('- - Controllers');
195 195
 		foreach ($controllerCompilerOutput as $controllerFile)
196 196
 		{
197
-			$this->info('- - - ' . $controllerFile);
197
+			$this->info('- - - '.$controllerFile);
198 198
 		}
199 199
 
200 200
 		$this->comment('- - Migrations');
201 201
 		foreach ($migrationCompilerOutput as $migrationFile)
202 202
 		{
203
-			$this->info('- - - ' . $migrationFile);
203
+			$this->info('- - - '.$migrationFile);
204 204
 		}
205 205
 
206 206
 		$this->comment('- - Models');
207 207
 		foreach ($modelCompilerOutput as $modelFile)
208 208
 		{
209
-			$this->info('- - - ' . $modelFile);
209
+			$this->info('- - - '.$modelFile);
210 210
 		}
211 211
 	}
212 212
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * Code Generation command for AngularJs Material design files.  
215 215
 	 * @return void
216 216
 	 */
217
-	private function handleAngularJs(){
217
+	private function handleAngularJs() {
218 218
 		// Get all the models
219 219
 		$modelsData = $this->getAllModelsData();
220 220
 
@@ -314,24 +314,24 @@  discard block
 block discarded – undo
314 314
 
315 315
 		$this->comment('- - Index Api');
316 316
 
317
-		$this->info('- - - ' . $fileApi);
317
+		$this->info('- - - '.$fileApi);
318 318
 
319 319
 		$this->comment('- - Resources');
320 320
 		foreach ($resourceCompilerOutput as $file)
321 321
 		{
322
-			$this->info('- - - ' . $file);
322
+			$this->info('- - - '.$file);
323 323
 		}
324 324
 
325 325
 		$this->comment('- - Modules');
326 326
 		foreach ($moduleCompilerOutput as $file)
327 327
 		{
328
-			$this->info('- - - ' . $file);
328
+			$this->info('- - - '.$file);
329 329
 		}
330 330
 
331 331
 		$this->comment('- - Translate');
332 332
 		foreach ($translateCompilerOutput as $file)
333 333
 		{
334
-			$this->info('- - - ' . $file);
334
+			$this->info('- - - '.$file);
335 335
 		}
336 336
 
337 337
 		$this->comment('- - Register');
@@ -339,19 +339,19 @@  discard block
 block discarded – undo
339 339
 		$this->comment('- - - Modules');
340 340
 		foreach ($registerModuleCompilerOutput as $file)
341 341
 		{
342
-			$this->info('- - - - ' . $file);
342
+			$this->info('- - - - '.$file);
343 343
 		}
344 344
 
345 345
 		$this->comment('- - - Controllers');
346 346
 		foreach ($registerControllerCompilerOutput as $file)
347 347
 		{
348
-			$this->info('- - - - ' . $file);
348
+			$this->info('- - - - '.$file);
349 349
 		}
350 350
 
351 351
 		$this->comment('- - - Templates');
352 352
 		foreach ($registerTemplateCompilerOutput as $file)
353 353
 		{
354
-			$this->info('- - - - ' . $file);
354
+			$this->info('- - - - '.$file);
355 355
 		}
356 356
 
357 357
 		$this->comment('- - List');
@@ -359,20 +359,20 @@  discard block
 block discarded – undo
359 359
 		$this->comment('- - - Modules');
360 360
 		foreach ($listModuleCompilerOutput as $file)
361 361
 		{
362
-			$this->info('- - - - ' . $file);
362
+			$this->info('- - - - '.$file);
363 363
 		}
364 364
 
365 365
 
366 366
 		$this->comment('- - - Controllers');
367 367
 		foreach ($listControllerCompilerOutput as $file)
368 368
 		{
369
-			$this->info('- - - - ' . $file);
369
+			$this->info('- - - - '.$file);
370 370
 		}
371 371
 
372 372
 		$this->comment('- - - Templates');
373 373
 		foreach ($listTemplateCompilerOutput as $file)
374 374
 		{
375
-			$this->info('- - - - ' . $file);
375
+			$this->info('- - - - '.$file);
376 376
 		}
377 377
 		/*
378 378
 		$this->comment('- - - Detail Dialog');
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	 * Generates Blade templates
396 396
 	 * @return void
397 397
 	 */
398
-	private function handleBlade(){
398
+	private function handleBlade() {
399 399
 		// Get all the models
400 400
 		$modelsData = $this->getAllModelsData();
401 401
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 			$modelName = $modelData->modelName;
441 441
 
442 442
 			// Create views directory
443
-			Directory::createIfNotExists(base_path('resources/views/' . strtolower($modelName)));
443
+			Directory::createIfNotExists(base_path('resources/views/'.strtolower($modelName)));
444 444
 
445 445
 			//set hash
446 446
 			$modelHash = $modelData->modelHash;
@@ -464,17 +464,17 @@  discard block
 block discarded – undo
464 464
 		array_push($viewCompilerOutput, $pageLayoutViewCompiler->compile(File::get($this->themeLayouts->getPagePath()), null, null, $scaffolderConfig, null, ['links' => $sidenavLinks]));
465 465
 
466 466
 		// Store create layout
467
-		$createLayout = PathParser::parse($scaffolderConfig->generator->paths->views). 'layouts/create.blade.php' ;
467
+		$createLayout = PathParser::parse($scaffolderConfig->generator->paths->views).'layouts/create.blade.php';
468 468
 		File::copy($this->themeLayouts->getCreatePath(), $createLayout);
469 469
 		array_push($viewCompilerOutput, $createLayout);
470 470
 
471 471
 		// Store edit layout
472
-		$editLayout = PathParser::parse($scaffolderConfig->generator->paths->views). 'layouts/edit.blade.php' ;
472
+		$editLayout = PathParser::parse($scaffolderConfig->generator->paths->views).'layouts/edit.blade.php';
473 473
 		File::copy($this->themeLayouts->getCreatePath(), $editLayout);
474 474
 		array_push($viewCompilerOutput, $editLayout);
475 475
 
476 476
 		// Store dashboard
477
-		$dashboardLayout = PathParser::parse($scaffolderConfig->generator->paths->views). 'layouts/dashboard.blade.php' ;
477
+		$dashboardLayout = PathParser::parse($scaffolderConfig->generator->paths->views).'layouts/dashboard.blade.php';
478 478
 		File::copy($this->themeLayouts->getCreatePath(), $dashboardLayout);
479 479
 		array_push($viewCompilerOutput, $dashboardLayout);
480 480
 
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 		$this->comment('- - Views');
488 488
 		foreach ($viewCompilerOutput as $viewFile)
489 489
 		{
490
-			$this->info('- - - ' . $viewFile);
490
+			$this->info('- - - '.$viewFile);
491 491
 		}
492 492
 
493 493
 	}
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 	 * Generates Blade templates
499 499
 	 * @return void
500 500
 	 */
501
-	private function handleLaravel(){
501
+	private function handleLaravel() {
502 502
 		// generate API
503 503
 		$this->handleApi();
504 504
 
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
 	 *
513 513
 	 * @return void
514 514
 	 */
515
-	private function getScaffolderConfig(){
515
+	private function getScaffolderConfig() {
516 516
 		// Get app config
517 517
 		$scaffolderConfig = Json::decodeFile(base_path('scaffolder-config/app.json'));
518 518
 
519 519
 		$scaffolderConfig->generator = $scaffolderConfig->generators->{$this->argument('app')};
520 520
 
521
-		return $scaffolderConfig ;
521
+		return $scaffolderConfig;
522 522
 	}
523 523
 
524 524
 	/**
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 *
527 527
 	 * @return object
528 528
 	 */
529
-	private function getAllModelsData(){
529
+	private function getAllModelsData() {
530 530
 
531 531
 		$modelFiles = File::allFiles(base_path('scaffolder-config/models/'));
532 532
 
@@ -543,67 +543,67 @@  discard block
 block discarded – undo
543 543
 
544 544
 
545 545
 			// Get model name
546
-			$modelName = CamelCase::convertToCamelCase(($modelFile->getBasename('.' . $modelFile->getExtension())));
546
+			$modelName = CamelCase::convertToCamelCase(($modelFile->getBasename('.'.$modelFile->getExtension())));
547 547
 
548 548
 			// Get model hash
549 549
 			$modelHash = md5_file($modelFile->getRealPath());
550 550
 
551 551
 			// Set model name
552
-			$modelData->modelName = $modelName ;
552
+			$modelData->modelName = $modelName;
553 553
 
554 554
 			// Set model name
555
-			$modelData->modelHash = $modelHash ;
555
+			$modelData->modelHash = $modelHash;
556 556
 
557 557
 			// get primary field or create 
558 558
 			$primaryField = $this->getPrimaryKeyField($modelData);
559 559
 
560 560
 			// put primary key at first position
561
-			if(isset($primaryField->declared) && !$primaryField->declared){
562
-				$modelData->fields = array_pad($modelData->fields, -(count($modelData->fields)+1), $primaryField);
561
+			if (isset($primaryField->declared) && !$primaryField->declared) {
562
+				$modelData->fields = array_pad($modelData->fields, -(count($modelData->fields) + 1), $primaryField);
563 563
 			}
564 564
 
565 565
 			// set timestamps
566
-			if($modelData->timeStamps){
566
+			if ($modelData->timeStamps) {
567 567
 				$createdAtField = new stdClass;
568
-				$createdAtField->name = "created_at" ;
569
-				$createdAtField->index = "none" ;
570
-				$createdAtField->declared =  false ;
571
-				$createdAtField->type = new stdClass ;
572
-				$createdAtField->type->ui = 'timestamp' ;
573
-				$createdAtField->type->db = 'datetime' ;
568
+				$createdAtField->name = "created_at";
569
+				$createdAtField->index = "none";
570
+				$createdAtField->declared = false;
571
+				$createdAtField->type = new stdClass;
572
+				$createdAtField->type->ui = 'timestamp';
573
+				$createdAtField->type->db = 'datetime';
574 574
 				$createdAtField->foreignKey = [];
575
-				$createdAtField->validations = "required" ;
575
+				$createdAtField->validations = "required";
576 576
 				$updatedAtField = clone($createdAtField);
577
-				$updatedAtField->name = "updated_at" ;
577
+				$updatedAtField->name = "updated_at";
578 578
 
579 579
 				array_push($modelData->fields, $createdAtField);
580 580
 				array_push($modelData->fields, $updatedAtField);
581 581
 			}
582 582
 
583
-			$modelsData[$modelData->tableName] = $modelData ;
583
+			$modelsData[$modelData->tableName] = $modelData;
584 584
 
585 585
 			// put all migrations pre-requisites in top of generation hieraquical
586
-			if(count($modelData->migrationPreRequisites) == 0){
586
+			if (count($modelData->migrationPreRequisites) == 0) {
587 587
 				$modelsData = Arrays::moveElement($modelsData, $modelData->tableName, 0);
588 588
 			}
589 589
 
590 590
 		}
591 591
 
592 592
 		// let put all pre-requisites in order
593
-		$actualTablePosition = 0 ;
593
+		$actualTablePosition = 0;
594 594
 		foreach ($modelsData as $key => $modelData)
595 595
 		{
596 596
 			// set migration order
597
-			$modelData->migrationOrder = isset($modelData->migrationOrder) ? $modelData->migrationOrder : $actualTablePosition ;
597
+			$modelData->migrationOrder = isset($modelData->migrationOrder) ? $modelData->migrationOrder : $actualTablePosition;
598 598
 
599 599
 			$positions = array_keys($modelsData);
600 600
 
601
-			foreach($modelData->migrationPreRequisites as $preRequiste){
601
+			foreach ($modelData->migrationPreRequisites as $preRequiste) {
602 602
 				$preRequisitePosition = array_search($preRequiste, $positions);
603 603
 				// change positions
604
-				if( $preRequisitePosition >  $actualTablePosition){
605
-					$modelData->migrationOrder = $preRequisitePosition ;
606
-					$modelsData[$preRequiste]->migrationOrder = $actualTablePosition ;
604
+				if ($preRequisitePosition > $actualTablePosition) {
605
+					$modelData->migrationOrder = $preRequisitePosition;
606
+					$modelsData[$preRequiste]->migrationOrder = $actualTablePosition;
607 607
 					$modelsData = Arrays::moveElement($modelsData, $preRequiste, $actualTablePosition);
608 608
 					
609 609
 				}
@@ -611,31 +611,31 @@  discard block
 block discarded – undo
611 611
 
612 612
 
613 613
 			// search for other fields relationships
614
-			foreach($modelData->fields as $field){
614
+			foreach ($modelData->fields as $field) {
615 615
 				
616 616
 
617
-				if(isset($field->foreignKey->relationship)){
617
+				if (isset($field->foreignKey->relationship)) {
618 618
 					switch ($field->foreignKey->relationship) {
619 619
 						case 'belongsTo':
620 620
 							// hasOne or hasMay are the inverse relationship for belongsTo
621
-							$relationship = new stdClass ;
622
-							$relationship->type  = $field->foreignKey->reverse ;
623
-							$relationship->foreignKey = $field->name ;
624
-							$relationship->localKey = $field->foreignKey->field ;
625
-							$relationship->modelName = $modelData->modelName ;
621
+							$relationship = new stdClass;
622
+							$relationship->type = $field->foreignKey->reverse;
623
+							$relationship->foreignKey = $field->name;
624
+							$relationship->localKey = $field->foreignKey->field;
625
+							$relationship->modelName = $modelData->modelName;
626 626
 							array_push($modelsData[$field->foreignKey->table]->reverseRelationships, $relationship);
627 627
 							break;
628 628
 						case 'belongsToMany':
629 629
 							// belongsToMany is the inverse relationship for belongsTo
630
-							$relationship = new stdClass ;
631
-							$relationship->type  = $field->foreignKey->reverse ;
632
-							$relationship->foreignKey = $field->name ;
630
+							$relationship = new stdClass;
631
+							$relationship->type = $field->foreignKey->reverse;
632
+							$relationship->foreignKey = $field->name;
633 633
 							$relationship->relatedTable = isset($field->relatedTable) ? $field->relatedTable : '';
634 634
 							$relationship->relatedField = isset($field->relatedField) ? $field->relatedField : '';
635 635
 							$relationship->ui = $field->type->ui;
636
-							$relationship->localKey = $field->foreignKey->field ;
637
-							$relationship->modelName = $modelData->modelName ;
638
-							$relationship->tableName = $modelData->tableName ;
636
+							$relationship->localKey = $field->foreignKey->field;
637
+							$relationship->modelName = $modelData->modelName;
638
+							$relationship->tableName = $modelData->tableName;
639 639
 							array_push($modelsData[$field->foreignKey->table]->reverseRelationships, $relationship);
640 640
 							break;
641 641
 						default:
@@ -648,36 +648,36 @@  discard block
 block discarded – undo
648 648
 			}
649 649
 			
650 650
 
651
-			$actualTablePosition++ ;
651
+			$actualTablePosition++;
652 652
 		}
653 653
 	
654 654
 		// $this->info(print_r($modelsData, 1));
655 655
 	
656
-		return $modelsData ;
656
+		return $modelsData;
657 657
 	
658 658
 	}
659 659
 
660
-	protected function getPrimaryKeyField($modelData){
660
+	protected function getPrimaryKeyField($modelData) {
661 661
 		$primaryKey = new stdClass;
662
-		$primaryKey->name = "id" ;
663
-		$primaryKey->index = "primary" ;
664
-		$primaryKey->declared =  false ;
665
-		$primaryKey->type = new stdClass ;
666
-		$primaryKey->type->ui = 'label' ;
667
-		$primaryKey->type->db = 'integer' ;
662
+		$primaryKey->name = "id";
663
+		$primaryKey->index = "primary";
664
+		$primaryKey->declared = false;
665
+		$primaryKey->type = new stdClass;
666
+		$primaryKey->type->ui = 'label';
667
+		$primaryKey->type->db = 'integer';
668 668
 		$primaryKey->foreignKey = [];
669
-		$primaryKey->validations = "required" ;
669
+		$primaryKey->validations = "required";
670 670
 
671 671
 		foreach ($modelData->fields as $field)
672 672
 		{
673 673
 			if ($field->index == 'primary')
674 674
 			{
675
-				$primaryKey = $field ;
675
+				$primaryKey = $field;
676 676
 				break;
677 677
 			}
678 678
 		}
679 679
 
680
-		return $primaryKey ;
680
+		return $primaryKey;
681 681
 	}
682 682
 
683 683
 }
684 684
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Commands/ServeCommand.php 2 patches
Unused Use Statements   -5 removed lines patch added patch discarded remove patch
@@ -3,15 +3,10 @@
 block discarded – undo
3 3
 namespace Scaffolder\Commands;
4 4
 
5 5
 use Illuminate\Console\Command;
6
-use Illuminate\Support\Facades\File;
7
-
8
-use stdClass ;
9 6
 
10 7
 // Support classes
11 8
 use Scaffolder\Support\Directory;
12 9
 use Scaffolder\Support\Json;
13
-use Scaffolder\Support\Arrays;
14
-use Scaffolder\Support\CamelCase;
15 10
 use Scaffolder\Compilers\Support\PathParser;
16 11
 
17 12
 
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use Illuminate\Console\Command;
6 6
 use Illuminate\Support\Facades\File;
7 7
 
8
-use stdClass ;
8
+use stdClass;
9 9
 
10 10
 // Support classes
11 11
 use Scaffolder\Support\Directory;
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	protected $description = 'Serve code for development purpose';
23 23
 
24 24
 	// app config var
25
-	private $scaffolderConfig ;
25
+	private $scaffolderConfig;
26 26
 
27 27
 	/**
28 28
 	 * Execute the Command.
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
 
35 35
 		$overwrite = false;
36 36
 
37
-		if($this->option('overwrite'))
37
+		if ($this->option('overwrite'))
38 38
 			$overwrite = true;
39 39
 
40 40
 		$generate = false;
41 41
 
42
-		if($this->option('generate'))
42
+		if ($this->option('generate'))
43 43
 			$generate = true;
44 44
 
45 45
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 			case 'webapp':
48 48
 				
49 49
 				// gera código somente se houver a opcao
50
-				if($generate) {
50
+				if ($generate) {
51 51
 					// Gera codigo da api
52 52
 					$this->call('scaffolder:generate', array('app' => 'api', '-c' => 'clear-all'));
53 53
 					
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	private function launchBackgroundProcess($call) {
91 91
 	 
92 92
 		// Windows
93
-		if($this->is_windows()){
93
+		if ($this->is_windows()) {
94 94
 			pclose(popen('start /b '.$call, 'r'));
95 95
 		}
96 96
 	 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	* Tells if we are running on Windows Platform
109 109
 	* @author raccettura
110 110
 	*/
111
-	private function is_windows(){
112
-		if(PHP_OS == 'WINNT' || PHP_OS == 'WIN32'){
111
+	private function is_windows() {
112
+		if (PHP_OS == 'WINNT' || PHP_OS == 'WIN32') {
113 113
 			return true;
114 114
 		}
115 115
 		return false;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	public function copyApiFiles($overwrite) {
120 120
 
121 121
 		$command = sprintf('cp -r %s "%s/." "%s"', 
122
-			(!$overwrite ? ' -u' : null) , 
122
+			(!$overwrite ? ' -u' : null), 
123 123
 			PathParser::parse($this->scaffolderConfig->generators->api->paths->base),
124 124
 			base_path());
125 125
 		
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
 		// copying page files
137 137
 		$command = sprintf('cp -r %s "%s/." "%s/"', 
138
-			(!$overwrite ? ' -u' : null) , 
138
+			(!$overwrite ? ' -u' : null), 
139 139
 			PathParser::parse($this->scaffolderConfig->generators->angularjs->paths->index),
140 140
 			PathParser::parse($this->scaffolderConfig->generators->angularjs->paths->resources));
141 141
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @return void
152 152
 	 */
153
-	private function getScaffolderConfig(){
153
+	private function getScaffolderConfig() {
154 154
 		// Get app config
155 155
 		$this->scaffolderConfig = Json::decodeFile(base_path('scaffolder-config/app.json'));
156 156
 
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/IndexApiCompiler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
6 6
 use Scaffolder\Compilers\AbstractCompiler;
7 7
 use Scaffolder\Compilers\Support\FileToCompile;
8 8
 use Scaffolder\Compilers\Support\PathParser;
9
-use Scaffolder\Support\Directory;
10 9
 
11 10
 class IndexApiCompiler extends AbstractCompiler
12 11
 {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 class IndexApiCompiler extends AbstractCompiler
12 12
 {
13 13
 	protected $cachePrefix 	= 'index_api_';
14
-	protected $stubFilename = 'IndexApi.js' ;
14
+	protected $stubFilename = 'IndexApi.js';
15 15
 
16 16
 	public function __construct($scaffolderConfig, $modelData = null)
17 17
 	{
18
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
18
+		$this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/';
19 19
 		parent::__construct($scaffolderConfig, $modelData);
20 20
 	}
21 21
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function compile($extra = null)
40 40
 	{
41
-		if (File::exists(base_path('scaffolder-config/cache/' . $this->cachePrefix  . self::CACHE_EXT)))
41
+		if (File::exists(base_path('scaffolder-config/cache/'.$this->cachePrefix.self::CACHE_EXT)))
42 42
 		{
43 43
 			return $this->store(new FileToCompile(true, $this->cachePrefix));
44 44
 		}
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	{
60 60
 		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->index);
61 61
 
62
-		return $folder  . 'index.api.js';
62
+		return $folder.'index.api.js';
63 63
 	}
64 64
 
65 65
 }
66 66
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/IndexModuleCompiler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,6 @@
 block discarded – undo
6 6
 use Scaffolder\Compilers\AbstractCompiler;
7 7
 use Scaffolder\Compilers\Support\FileToCompile;
8 8
 use Scaffolder\Compilers\Support\PathParser;
9
-use Scaffolder\Support\CamelCase;
10 9
 
11 10
 class IndexModuleCompiler extends AbstractCompiler
12 11
 {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@  discard block
 block discarded – undo
10 10
 
11 11
 class IndexModuleCompiler extends AbstractCompiler
12 12
 {
13
-	protected $stubFilename = 'IndexModule.js' ;
13
+	protected $stubFilename = 'IndexModule.js';
14 14
 
15
-	protected $stubResourceFilename = 'IndexModuleModel.js' ;
16
-	protected $stubResource  ;
15
+	protected $stubResourceFilename = 'IndexModuleModel.js';
16
+	protected $stubResource;
17 17
 
18 18
 
19 19
 	public function __construct($scaffolderConfig, $modelData = null)
20 20
 	{
21
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
21
+		$this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/';
22 22
 		parent::__construct($scaffolderConfig, null);
23 23
 		
24
-		$this->stubResource = File::get($this->stubsDirectory . $this->stubResourceFilename );
24
+		$this->stubResource = File::get($this->stubsDirectory.$this->stubResourceFilename);
25 25
 	}
26 26
 
27 27
 	/**
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @return string
31 31
 	 */
32
-	public function replaceAndStore(){}
32
+	public function replaceAndStore() {}
33 33
 
34 34
 	/**
35 35
 	 * Compiles a resource.
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	{
70 70
 		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->index);
71 71
 
72
-		return $folder  . 'index.module.js';
72
+		return $folder.'index.module.js';
73 73
 	}
74 74
 
75 75
 
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/ListChooseColumnsCompiler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace Scaffolder\Compilers\AngularJs;
4 4
 
5
-use Illuminate\Support\Facades\File;
6 5
 use Scaffolder\Compilers\AbstractCompiler;
7 6
 use Scaffolder\Compilers\Support\FileToCompile;
8 7
 use Scaffolder\Compilers\Support\PathParser;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 class ListChooseColumnsCompiler extends AbstractCompiler
12 12
 {
13 13
 	protected $cachePrefix 	= 'list_choose_column_';
14
-	protected $stubFilename = 'ChooseColumnsDialog.html' ;
14
+	protected $stubFilename = 'ChooseColumnsDialog.html';
15 15
 
16 16
 	public function __construct($scaffolderConfig, $modelData = null)
17 17
 	{
18
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
18
+		$this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/';
19 19
 		parent::__construct($scaffolderConfig, $modelData);
20 20
 	}
21 21
 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	protected function getOutputFilename()
41 41
 	{
42
-		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ;
42
+		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/';
43 43
 
44 44
 		Directory::createIfNotExists($folder, 0755, true);
45 45
 
46
-		return $folder .$this->modelData->tableName . '_columns.dialog.html';
46
+		return $folder.$this->modelData->tableName.'_columns.dialog.html';
47 47
 	}
48 48
 
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/ListControllerCompiler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace Scaffolder\Compilers\AngularJs;
4 4
 
5
-use Illuminate\Support\Facades\File;
6 5
 use Scaffolder\Compilers\AbstractCompiler;
7 6
 use Scaffolder\Compilers\Support\FileToCompile;
8 7
 use Scaffolder\Compilers\Support\PathParser;
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 class ListControllerCompiler extends AbstractCompiler
12 12
 {
13 13
 	protected $cachePrefix 	= 'list_controller_';
14
-	protected $stubFilename = 'ListController.js' ;
14
+	protected $stubFilename = 'ListController.js';
15 15
 
16 16
 	public function __construct($scaffolderConfig, $modelData = null)
17 17
 	{
18
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
18
+		$this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/';
19 19
 		parent::__construct($scaffolderConfig, $modelData);
20 20
 	}
21 21
 
@@ -37,23 +37,23 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @return $this
39 39
 	 */
40
-	public function replaceColumns(){
40
+	public function replaceColumns() {
41 41
 
42 42
 		$columns = $this->getGridColumns();
43 43
 
44
-		$this->stub = str_replace('{{grid_columns}}',  join(",\n ", $columns) , $this->stub); 
44
+		$this->stub = str_replace('{{grid_columns}}', join(",\n ", $columns), $this->stub); 
45 45
 
46
-		return $this ;
46
+		return $this;
47 47
 
48 48
 	}
49 49
 
50
-	public function getGridColumns(){
50
+	public function getGridColumns() {
51 51
 
52 52
 		$columns = [];
53 53
 
54 54
 		foreach ($this->modelData->fields as $field)
55 55
 		{
56
-			array_push($columns,  "\t\t\t".sprintf('{ name: vm. $t("%s.columns.%s"), field: "%s%s" }',  $this->modelData->tableName, $field->name, $this->eagerTable, $field->name ) );
56
+			array_push($columns, "\t\t\t".sprintf('{ name: vm. $t("%s.columns.%s"), field: "%s%s" }', $this->modelData->tableName, $field->name, $this->eagerTable, $field->name));
57 57
 
58 58
 			// Check foreign key
59 59
 			if ($field->foreignKey && isset($field->foreignKey->eager) && $field->foreignKey->eager)
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				$foreignModelData = $this->getModelData($field->foreignKey->table);
63 63
 				$foreignControllerCompiler = new ListControllerCompiler($this->scaffolderConfig, $foreignModelData);
64 64
 				$foreignControllerCompiler->setEagerTable($field->foreignKey->table);
65
-				$eagerColumns 	= $foreignControllerCompiler->getGridColumns();
65
+				$eagerColumns = $foreignControllerCompiler->getGridColumns();
66 66
 
67 67
 				$columns = array_merge($columns, $eagerColumns);
68 68
 			}
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	protected function getOutputFilename()
83 83
 	{
84
-		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ;
84
+		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/';
85 85
 
86 86
 		Directory::createIfNotExists($folder, 0755, true);
87 87
 
88
-		return $folder .$this->modelData->tableName . '_list.controller.js';
88
+		return $folder.$this->modelData->tableName.'_list.controller.js';
89 89
 	}
90 90
 
91 91
 }
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/ListDetailCompiler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace Scaffolder\Compilers\AngularJs;
4 4
 
5
-use Illuminate\Support\Facades\File;
6 5
 use Scaffolder\Compilers\AbstractCompiler;
7 6
 use Scaffolder\Compilers\Support\FileToCompile;
8 7
 use Scaffolder\Compilers\Support\PathParser;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 class ListDetailCompiler extends AbstractCompiler
12 12
 {
13 13
 	protected $cachePrefix 	= 'list_detail_';
14
-	protected $stubFilename = 'DetailDialog.html' ;
14
+	protected $stubFilename = 'DetailDialog.html';
15 15
 
16 16
 	public function __construct($scaffolderConfig, $modelData = null)
17 17
 	{
18
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
18
+		$this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/';
19 19
 		parent::__construct($scaffolderConfig, $modelData);
20 20
 	}
21 21
 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	protected function getOutputFilename()
41 41
 	{
42
-		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ;
42
+		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/';
43 43
 
44 44
 		Directory::createIfNotExists($folder, 0755, true);
45 45
 
46
-		return $folder .$this->modelData->tableName . '_details.dialog.html';
46
+		return $folder.$this->modelData->tableName.'_details.dialog.html';
47 47
 	}
48 48
 
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/ListModuleCompiler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace Scaffolder\Compilers\AngularJs;
4 4
 
5
-use Illuminate\Support\Facades\File;
6 5
 use Scaffolder\Compilers\AbstractCompiler;
7 6
 use Scaffolder\Compilers\Support\FileToCompile;
8 7
 use Scaffolder\Compilers\Support\PathParser;
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 class ListModuleCompiler extends AbstractCompiler
12 12
 {
13 13
 	protected $cachePrefix 	= 'list_module_';
14
-	protected $stubFilename = 'ListModule.js' ;
14
+	protected $stubFilename = 'ListModule.js';
15 15
 
16 16
 	public function __construct($scaffolderConfig, $modelData = null)
17 17
 	{
18
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
18
+		$this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/';
19 19
 		parent::__construct($scaffolderConfig, $modelData);
20 20
 	}
21 21
 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	protected function getOutputFilename()
41 41
 	{
42
-		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ;
42
+		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/';
43 43
 
44 44
 		Directory::createIfNotExists($folder, 0755, true);
45 45
 
46
-		return $folder .$this->modelData->tableName . '_list.module.js';
46
+		return $folder.$this->modelData->tableName.'_list.module.js';
47 47
 	}
48 48
 
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/ListTemplateCompiler.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 use Scaffolder\Support\Directory;
10 10
 use Scaffolder\Support\CamelCase;
11 11
 use Scaffolder\Support\Validator;
12
-use stdClass ;
13 12
 
14 13
 class ListTemplateCompiler extends AbstractCompiler
15 14
 {
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
 use Scaffolder\Support\Directory;
10 10
 use Scaffolder\Support\CamelCase;
11 11
 use Scaffolder\Support\Validator;
12
-use stdClass ;
12
+use stdClass;
13 13
 
14 14
 class ListTemplateCompiler extends AbstractCompiler
15 15
 {
16 16
 	protected $cachePrefix 	= 'list_template_';
17
-	protected $stubFilename = 'ListTemplate.html' ;
17
+	protected $stubFilename = 'ListTemplate.html';
18 18
 
19 19
 	public function __construct($scaffolderConfig, $modelData = null)
20 20
 	{
21
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
21
+		$this->stubsDirectory = __DIR__.'/../../../../stubs/AngularJs/';
22 22
 		parent::__construct($scaffolderConfig, $modelData);
23 23
 	}
24 24
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @return $this
43 43
 	 */
44
-	private function replaceInputFields(){
44
+	private function replaceInputFields() {
45 45
 
46 46
 		$inputFields = $this->getInputFields();
47 47
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return $this
57 57
 	 */
58
-	public function getInputFields(){
58
+	public function getInputFields() {
59 59
 
60 60
 		$inputFields = $eagerFields = '';
61 61
 
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
 		{
64 64
 			$fieldStub = $this->getInputStubByField($field);
65 65
 
66
-			if($field->foreignKey){
67
-				$fieldStub 	= $this->replaceForeingStrings($field, $fieldStub) ;
66
+			if ($field->foreignKey) {
67
+				$fieldStub = $this->replaceForeingStrings($field, $fieldStub);
68 68
 				$fieldStub = str_replace('{{foreign_model_name}}', strtolower(CamelCase::convertToCamelCase($field->foreignKey->table)), $fieldStub);
69 69
 			}
70 70
 
71
-			$inputFields .= $this->replaceFieldInput($field, $fieldStub) ;
71
+			$inputFields .= $this->replaceFieldInput($field, $fieldStub);
72 72
 
73 73
 			// Check foreign key
74 74
 			if ($field->foreignKey && isset($field->foreignKey->eager) && $field->foreignKey->eager)
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 				$foreignModelData = $this->getModelData($field->foreignKey->table);
78 78
 				$foreignControllerCompiler = new ListTemplateCompiler($this->scaffolderConfig, $foreignModelData);
79 79
 				$foreignControllerCompiler->setEagerTable($this->modelData->tableName);
80
-				$eagerFields 	.= $foreignControllerCompiler->getInputFields();
80
+				$eagerFields .= $foreignControllerCompiler->getInputFields();
81 81
 			}
82 82
 
83 83
 		}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		
88 88
 		$this->stub = str_replace('{{eager_objects_inputs}}', $eagerFields, $this->stub); 
89 89
 
90
-		return $inputFields ;
90
+		return $inputFields;
91 91
 
92 92
 	}
93 93
 
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 * @return $this
101 101
 	 */
102
-	protected function replaceFieldInput($field, $fieldStub){
103
-		$fieldStub = $this->replaceFieldStrings($field, $fieldStub) ;
104
-		$fieldStub = $this->replaceFieldValidations($field, $fieldStub) ;
102
+	protected function replaceFieldInput($field, $fieldStub) {
103
+		$fieldStub = $this->replaceFieldStrings($field, $fieldStub);
104
+		$fieldStub = $this->replaceFieldValidations($field, $fieldStub);
105 105
 
106
-		return $fieldStub ;
106
+		return $fieldStub;
107 107
 	}
108 108
 
109 109
 	/**
@@ -114,23 +114,23 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @return $this
116 116
 	 */
117
-	protected function replaceFieldValidations($field, $fieldStub){
118
-		$fieldStub = $this->replaceFieldStrings($field, $fieldStub) ;
117
+	protected function replaceFieldValidations($field, $fieldStub) {
118
+		$fieldStub = $this->replaceFieldStrings($field, $fieldStub);
119 119
 		
120 120
 		$validationsConverted = Validator::convertValidations($field->validations, true);
121 121
 
122
-		$inputValidations = '' ; 
122
+		$inputValidations = ''; 
123 123
 
124 124
 		foreach ($validationsConverted as $attribute => $value) {
125
-			if($value)
126
-				$inputValidations .=  ' '.$attribute.'="'. $value.'"' ;
125
+			if ($value)
126
+				$inputValidations .= ' '.$attribute.'="'.$value.'"';
127 127
 			else
128
-				$inputValidations .=  ' '.$attribute  ; 
128
+				$inputValidations .= ' '.$attribute; 
129 129
 		}
130 130
 
131 131
 		$fieldStub = str_replace('{{field_validation}}', $inputValidations, $fieldStub);
132 132
 
133
-		return $fieldStub ;
133
+		return $fieldStub;
134 134
 	}
135 135
 
136 136
 	/**
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 		foreach ($this->modelData->reverseRelationships as $relationship)
146 146
 		{
147 147
 			if ($relationship->type == "belongsToMany") {
148
-				$fieldStub = File::get($this->stubsDirectory . 'List/'. CamelCase::convertToCamelCase($relationship->ui). '.html');
148
+				$fieldStub = File::get($this->stubsDirectory.'List/'.CamelCase::convertToCamelCase($relationship->ui).'.html');
149 149
 
150
-				$fieldStub = str_replace('{{related_table}}',CamelCase::convertToCamelCase($relationship->relatedTable), $fieldStub);
150
+				$fieldStub = str_replace('{{related_table}}', CamelCase::convertToCamelCase($relationship->relatedTable), $fieldStub);
151 151
 				$fieldStub = str_replace('{{related_table_lw}}', strtolower(CamelCase::convertToCamelCase($relationship->relatedTable)), $fieldStub);
152 152
 				$fieldStub = str_replace('{{table_name}}', $this->modelData->tableName, $fieldStub);
153 153
 				$fieldStub = str_replace('{{related_table_lw_pl}}', CamelCase::pluralize(strtolower($relationship->relatedTable)), $fieldStub);
@@ -170,26 +170,26 @@  discard block
 block discarded – undo
170 170
 	 * @return $this
171 171
 	 */
172 172
 	private $inputStub = [];
173
-	private function getInputStubByField($field){
173
+	private function getInputStubByField($field) {
174 174
 		
175
-		if($field->index == 'primary'){
176
-			$uiType = 'primary' ;
175
+		if ($field->index == 'primary') {
176
+			$uiType = 'primary';
177 177
 		}
178
-		elseif(isset($field->foreignKey) && $field->foreignKey){
179
-			if(isset($field->foreignKey->eager) && $field->foreignKey->eager)
180
-				$uiType = 'foreign_eager' ;
178
+		elseif (isset($field->foreignKey) && $field->foreignKey) {
179
+			if (isset($field->foreignKey->eager) && $field->foreignKey->eager)
180
+				$uiType = 'foreign_eager';
181 181
 			else 
182
-				$uiType = $field->type->ui ;
182
+				$uiType = $field->type->ui;
183 183
 		}
184 184
 		else {
185
-			$uiType = $field->type->ui ;
185
+			$uiType = $field->type->ui;
186 186
 		}
187 187
 
188
-		if(array_key_exists($uiType, $this->inputStub)){
188
+		if (array_key_exists($uiType, $this->inputStub)) {
189 189
 			return $this->inputStub[$uiType];
190 190
 		}
191 191
 		else {
192
-			$this->inputStub[$uiType] = File::get($this->stubsDirectory . 'List/'. CamelCase::convertToCamelCase($uiType). '.html');
192
+			$this->inputStub[$uiType] = File::get($this->stubsDirectory.'List/'.CamelCase::convertToCamelCase($uiType).'.html');
193 193
 
194 194
 			return $this->inputStub[$uiType];
195 195
 		}
@@ -203,11 +203,11 @@  discard block
 block discarded – undo
203 203
 	 */
204 204
 	protected function getOutputFilename()
205 205
 	{
206
-		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ;
206
+		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/';
207 207
 
208 208
 		Directory::createIfNotExists($folder, 0755, true);
209 209
 
210
-		return $folder .$this->modelData->tableName . '_list.html';
210
+		return $folder.$this->modelData->tableName.'_list.html';
211 211
 	}
212 212
 
213 213
 }
214 214
\ No newline at end of file
Please login to merge, or discard this patch.