Passed
Branch master (972013)
by karam
08:54
created
src/Tests/Feature/FileTest.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
 {
10 10
 
11 11
     /** @test */
12
-    public function test_is_working(){
12
+    public function test_is_working() {
13 13
         $this->assertTrue(True);
14 14
     }
15 15
 }
Please login to merge, or discard this patch.
src/BuildClasses/KMControllerBuilder.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,9 @@
 block discarded – undo
91 91
      */
92 92
     protected function classReplacer($option)
93 93
     {
94
-        if (!gettype($option) == 'array') $option = [$option];
94
+        if (!gettype($option) == 'array') {
95
+            $option = [$option];
96
+        }
95 97
         $this->paths = array_intersect_key($this->paths, $option);
96 98
         foreach ($option as $path => $classNameSpace) {
97 99
             $className = $this->getCLassName($classNameSpace);
Please login to merge, or discard this patch.
src/Services/GeneratorService.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function initialRequest($request): GeneratorService
52 52
     {
53
-        [$this->request , $this->column , $this->apiTitle ] = [$request , $request->column , $request->title];
53
+        [$this->request, $this->column, $this->apiTitle] = [$request, $request->column, $request->title];
54 54
         // append all basic options that actor want to run migration  to new array
55 55
         foreach ($this->request->basic_options as $item => $status) {
56 56
             $this->basicBuildOption [] = $item;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
         $this->setBaseControllerExists();
84 84
         // merge basic options and advanced options.
85 85
         //we here want to be advanced options last options to run inside foreach.
86
-        $options = array_merge($this->basicBuildOption , $this->advancedBuildOption);
86
+        $options = array_merge($this->basicBuildOption, $this->advancedBuildOption);
87 87
         foreach ($options as $option) {
88 88
             if (method_exists(__CLASS__, $option)) {
89 89
                 $this->$option();
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $builder = new KMModelAndMigrationBuilder();
108 108
         $modelClass = "$this->apiTitle";
109
-        $migrationRequired = in_array("buildMigration" , $this->basicBuildOption) ? "-m" : "";
109
+        $migrationRequired = in_array("buildMigration", $this->basicBuildOption) ? "-m" : "";
110 110
         $builder->initialResource($modelClass, "modelAndMigrationReplacer")
111 111
             ->callArtisan($migrationRequired)
112 112
             ->build($this->column, ["migrationRequired" => $migrationRequired]);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     protected function buildRequests()
148 148
     {
149 149
         $builder = new KMRequestBuilder();
150
-        $requestClass = "$this->apiTitle" . "Request";
150
+        $requestClass = "$this->apiTitle"."Request";
151 151
         $builder->initialResource($requestClass, "requestReplacer")
152 152
             ->callArtisan()
153 153
             ->build($this->column);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     protected function buildController()
169 169
     {
170 170
         $builder = new KMControllerBuilder();
171
-        $controllerClass = "$this->apiTitle" . "Controller";
171
+        $controllerClass = "$this->apiTitle"."Controller";
172 172
         $controllerBuildType = !$this->baseControllerExists ? "basicBuild" : "build";
173 173
         return $builder->initialResource($controllerClass, "controllerReplacer")
174 174
             ->callArtisan()
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
      */
184 184
     protected function buildResource()
185 185
     {
186
-        Artisan::call("make:resource " . "$this->apiTitle" . "Resource");
187
-        return $this->paths["{{ resource_path }}"] = KMFileFacade::getClassNameSpace("Resources", "$this->apiTitle" . "Resource");
186
+        Artisan::call("make:resource "."$this->apiTitle"."Resource");
187
+        return $this->paths["{{ resource_path }}"] = KMFileFacade::getClassNameSpace("Resources", "$this->apiTitle"."Resource");
188 188
     }
189 189
 
190 190
     /**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     {
200 200
         $data = [
201 201
             "title" => $this->apiTitle,
202
-            "route" => "$this->apiTitle" . "Controller",
202
+            "route" => "$this->apiTitle"."Controller",
203 203
             "url" => "$this->apiTitle",
204 204
             "name" => "$this->apiTitle",
205 205
             "type" => "resource",
Please login to merge, or discard this patch.
src/BuildClasses/KMBaseBuilder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
             $validation = [];
77 77
         }
78 78
         return $this->replacement(
79
-            ["{{ rules }}", "{{ request_class }}" , "{{ request_auth }}"]
80
-            , [$validationRow, $this->fileName , KMFunctionsFacade::getRequestAuthAccessibility()],
79
+            ["{{ rules }}", "{{ request_class }}", "{{ request_auth }}"]
80
+            , [$validationRow, $this->fileName, KMFunctionsFacade::getRequestAuthAccessibility()],
81 81
             $this->fileToCreate, $this->filepath);
82 82
     }
83 83
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         // model area
94 94
         $fillable = [];
95 95
         $protectedFillable = "";
96
-        $databaseColumn = '$table->id();' . "\n";
96
+        $databaseColumn = '$table->id();'."\n";
97 97
         // we build here fillabel for model and column for migration file at once.
98 98
         foreach ($columns as $name => $item) {
99 99
             // build fillabe property in model.
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
             // get column type.
102 102
             $type = array_key_first($item['type']);
103 103
             // put this column as this ex : $table->string('name').
104
-            $databaseColumn .= '$table->' . "$type('$name'); \n";
104
+            $databaseColumn .= '$table->'."$type('$name'); \n";
105 105
         }
106 106
         $imp = implode(",", $fillable);
107
-        $protectedFillable .= 'protected $fillable = ' . " [$imp];";
107
+        $protectedFillable .= 'protected $fillable = '." [$imp];";
108 108
         $this->replacement("//", $protectedFillable, $options["file"], $options["path"]);
109 109
         // check if user choose to build migration.
110 110
         if (isset($options['migrationRequired'])) {
Please login to merge, or discard this patch.
src/Helpers/KMFile.php 1 patch
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 static function getFilesFromStubs($fileName)
16 16
     {
17
-        return __DIR__ . "/../Stubs/$fileName.stub";
17
+        return __DIR__."/../Stubs/$fileName.stub";
18 18
     }
19 19
 
20 20
     /**
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public static function getFilesFromStubsAsStream($fileName)
25 25
     {
26
-        return File::get(__DIR__ . "/../Stubs/$fileName.stub");
26
+        return File::get(__DIR__."/../Stubs/$fileName.stub");
27 27
     }
28 28
 
29 29
     /**
Please login to merge, or discard this patch.
src/Helpers/KMRoutes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@
 block discarded – undo
9 9
 {
10 10
     public static function getRoutes()
11 11
     {
12
-        return Route::group([], function () {
12
+        return Route::group([], function() {
13 13
             $extraRoutes = KMFileFacade::getCredentialJsonFileAsJson();
14
-            if (isset($extraRoutes)){
14
+            if (isset($extraRoutes)) {
15 15
                 foreach ($extraRoutes as $api) {
16 16
                     if (isset($api->route) && isset($api->url)) {
17 17
                         Route::apiResource($api->url, $api->route);
Please login to merge, or discard this patch.
src/Controllers/ApisGeneratorController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,6 +18,6 @@
 block discarded – undo
18 18
     public function create(ApisGeneratorRequest $request)
19 19
     {
20 20
         $this->generatorService->initialRequest($request)->generateApi();
21
-        return redirect()->route('apisGenerator.index')->with('session_success' , 'create new api successfully');
21
+        return redirect()->route('apisGenerator.index')->with('session_success', 'create new api successfully');
22 22
     }
23 23
 }
Please login to merge, or discard this patch.
src/Providers/ApisGeneratorServiceProviders.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@  discard block
 block discarded – undo
9 9
 class ApisGeneratorServiceProviders extends ServiceProvider
10 10
 {
11 11
 
12
-    public function boot(){
12
+    public function boot() {
13 13
         $this->registerFacades();
14 14
         $this->publishesPackages();
15 15
         $this->loadResource();
16 16
 
17 17
     }
18 18
 
19
-    public function register(){
19
+    public function register() {
20 20
     }
21 21
 
22 22
     /**
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
      */
33 33
     protected function registerFacades()
34 34
     {
35
-        $this->app->singleton("KMFileFacade" , function ($app){
35
+        $this->app->singleton("KMFileFacade", function($app) {
36 36
             return new KMFile();
37 37
         });
38
-        $this->app->singleton("KMRoutesFacade" , function ($app){
38
+        $this->app->singleton("KMRoutesFacade", function($app) {
39 39
             return new KMRoutes();
40 40
         });
41
-        $this->app->singleton("KMFunctionsFacade" , function ($app){
41
+        $this->app->singleton("KMFunctionsFacade", function($app) {
42 42
             return new KMFunctions();
43 43
         });
44 44
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $cssPath = "ApisGenerator/css";
55 55
         $this->publishes([
56 56
             __DIR__."/../Config/apis_generator.php" => config_path("apis_generator.php")
57
-        ] , "apis-generator-config");
57
+        ], "apis-generator-config");
58 58
 
59 59
         $this->publishes([
60 60
             $asset."create.blade.php" => resource_path("$views/create.blade.php"),
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $asset."_layouts.blade.php" => resource_path("$views/layouts/_layouts.blade.php"),
64 64
             $asset."script.js" => public_path("$scriptPath/script.js"),
65 65
             $asset."css.css" => public_path("$cssPath/css.css"),
66
-        ] , "apis-generator-asset");
66
+        ], "apis-generator-asset");
67 67
 
68 68
     }
69 69
 
Please login to merge, or discard this patch.
src/Routes/Routes.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -4,16 +4,16 @@
 block discarded – undo
4 4
 use KMLaravel\ApiGenerator\Facade\KMFunctionsFacade;
5 5
 
6 6
 Route::namespace("KMLaravel\ApiGenerator\Controllers")
7
-    ->group(function () {
7
+    ->group(function() {
8 8
         // this is pull middleware information from apis_generator.php config file
9
-        Route::group(['middleware' => array_merge(['web'], KMFunctionsFacade::getMiddleware() ?? [])], function () {
10
-            Route::group([], function () {
9
+        Route::group(['middleware' => array_merge(['web'], KMFunctionsFacade::getMiddleware() ?? [])], function() {
10
+            Route::group([], function() {
11 11
                 // all apis table page
12
-                Route::get('/apis-generator/index', function () {
12
+                Route::get('/apis-generator/index', function() {
13 13
                     return view('ApisGenerator/index');
14 14
                 })->name('apisGenerator.index');
15 15
                 // create new api page
16
-                Route::get('/apis-generator/create', function () {
16
+                Route::get('/apis-generator/create', function() {
17 17
                     return view('ApisGenerator/create');
18 18
                 })->name('apisGenerator.create');
19 19
                 // post information route
Please login to merge, or discard this patch.