Passed
Push — master ( d471b8...9bc01c )
by Mohammad
03:56 queued 11s
created
src/Forms/FormGenerator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function generateForm($entity, $method = 'post')
74 74
     {
75 75
         $html = '<form method="post" action="#">
76
-           <input type="hidden" name="__method" value="'.$method.'">';
76
+           <input type="hidden" name="__method" value="'.$method . '">';
77 77
         $html .= $this->getInputs($entity);
78 78
         $html .= '</form>';
79 79
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     public function getFillables($entity)
89 89
     {
90
-        if (! empty($entity->getFillable())) {
90
+        if (!empty($entity->getFillable())) {
91 91
             return $entity->getFillable();
92 92
         }
93 93
 
Please login to merge, or discard this patch.
src/Forms/Forms.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,6 +72,6 @@
 block discarded – undo
72 72
 
73 73
     public function getFormStub($type)
74 74
     {
75
-        return file_get_contents(Config::get('repository.stubs_path').'/fields-'.$type.'.stub');
75
+        return file_get_contents(Config::get('repository.stubs_path') . '/fields-' . $type . '.stub');
76 76
     }
77 77
 }
Please login to merge, or discard this patch.
src/RepositoryServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,14 +40,14 @@
 block discarded – undo
40 40
         parent::__construct($app);
41 41
 
42 42
         if (null === $this->app['config']->get('repository')) {
43
-            $this->app['config']->set('repository', require __DIR__.'/config/repository.php');
43
+            $this->app['config']->set('repository', require __DIR__ . '/config/repository.php');
44 44
         }
45 45
         $interfaces = Str::plural(Config::get('repository.interface'));
46 46
         $repositories = Str::plural(Config::get('repository.repository'));
47 47
         $interface = Config::get('repository.interface');
48 48
         $repository = Config::get('repository.repository');
49 49
 
50
-        $contractsFolder = Config::get('repository.app_path').'/'.$interfaces;
50
+        $contractsFolder = Config::get('repository.app_path') . '/' . $interfaces;
51 51
 
52 52
         if (is_dir($contractsFolder)) {
53 53
             $directory = new RecursiveDirectoryIterator($contractsFolder);
Please login to merge, or discard this patch.
src/Utility/AbstractRepository.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,17 +98,17 @@
 block discarded – undo
98 98
         if (isset($criteria['search'])) {
99 99
             foreach ($this->model->searchable as $method => $columns) {
100 100
                 if (method_exists($this->model, $method)) {
101
-                    $latest->orWhereHas($method, function ($query) use ($criteria, $columns) {
101
+                    $latest->orWhereHas($method, function($query) use ($criteria, $columns) {
102 102
                         /* @var $query Builder */
103
-                        $query->where(function ($query2) use ($criteria, $columns) {
103
+                        $query->where(function($query2) use ($criteria, $columns) {
104 104
                             /* @var $query2 Builder */
105 105
                             foreach ((array) $columns as $column) {
106
-                                $query2->orWhere($column, 'like', '%'.$criteria['search'].'%');
106
+                                $query2->orWhere($column, 'like', '%' . $criteria['search'] . '%');
107 107
                             }
108 108
                         });
109 109
                     });
110 110
                 } else {
111
-                    $latest->orWhere($columns, 'like', '%'.$criteria['search'].'%');
111
+                    $latest->orWhere($columns, 'like', '%' . $criteria['search'] . '%');
112 112
                 }
113 113
             }
114 114
         }
Please login to merge, or discard this patch.
src/Utility/Controller.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $this->breadcrumbs = new Collection();
66 66
 
67 67
         $language = $request->header('Language', 'en');
68
-        if (! in_array($language, Config::get('app.locales', []))) {
68
+        if (!in_array($language, Config::get('app.locales', []))) {
69 69
             $language = 'en';
70 70
         }
71 71
         $limit = $request->get('limit', 10);
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
         $this->interface = $interface;
112 112
         $this->isAPI = $request->expectsJson();
113 113
 
114
-        if (! $this->isAPI) {
114
+        if (!$this->isAPI) {
115 115
             $this->breadcrumbs = new Collection();
116 116
             $this->search = new Collection();
117
-            View::share('pageTitle', $this->pageTitle.' | '.Config::get('app.name'));
117
+            View::share('pageTitle', $this->pageTitle . ' | ' . Config::get('app.name'));
118 118
             View::share('breadcrumbs', $this->breadcrumbs);
119 119
             View::share('menu', $this->menu);
120 120
             View::share('search', $this->search);
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
     public function index()
133 133
     {
134 134
         $data = $this->interface->simplePaginate($this->limit, $this->request->all());
135
-        if (! $this->isAPI) {
136
-            View::share('pageTitle', 'List '.$this->pageTitle.' | '.Config::get('app.name'));
135
+        if (!$this->isAPI) {
136
+            View::share('pageTitle', 'List ' . $this->pageTitle . ' | ' . Config::get('app.name'));
137 137
             $this->breadcrumbs->put('index', [
138 138
                 'link' => $this->routeIndex,
139 139
                 'text' => $this->pageTitle,
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
      */
163 163
     public function create()
164 164
     {
165
-        if (! $this->isAPI) {
166
-            View::share('pageTitle', 'Create '.$this->pageTitle.' | '.Config::get('app.name'));
165
+        if (!$this->isAPI) {
166
+            View::share('pageTitle', 'Create ' . $this->pageTitle . ' | ' . Config::get('app.name'));
167 167
             $this->breadcrumbs->put('create', [
168 168
                 'link' => $this->createRoute,
169 169
                 'text' => trans('repository-generator.create'),
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
     public function show($entityId)
198 198
     {
199 199
         $entity = $this->interface->find($entityId);
200
-        if (! $this->isAPI) {
201
-            if (! $entity) {
200
+        if (!$this->isAPI) {
201
+            if (!$entity) {
202 202
                 return Redirect::to($this->routeIndex)->with('warning', __('repository-generator.not_found'));
203 203
             }
204
-            View::share('pageTitle', 'View '.$this->pageTitle.' | '.Config::get('app.name'));
204
+            View::share('pageTitle', 'View ' . $this->pageTitle . ' | ' . Config::get('app.name'));
205 205
             $this->breadcrumbs->put('view', [
206 206
                 'link' => '',
207 207
                 'text' => __('repository-generator.show'),
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             return view($this->viewShow, $this->params)
211 211
                 ->with('entity', $entity);
212 212
         }
213
-        if (! $entity) {
213
+        if (!$entity) {
214 214
             return response()->json(null, JsonResponse::HTTP_NOT_FOUND);
215 215
         }
216 216
 
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
     public function edit($entityId)
231 231
     {
232 232
         $entity = $this->interface->find($entityId);
233
-        if (! $this->isAPI) {
234
-            if (! $entity) {
233
+        if (!$this->isAPI) {
234
+            if (!$entity) {
235 235
                 return Redirect::to($this->routeIndex)->with('warning', __('repository-generator.not_found'));
236 236
             }
237 237
             $this->breadcrumbs->put('edit', [
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
      */
315 315
     public function makeResponse($entity, $appendEntity = false)
316 316
     {
317
-        if (! $this->isAPI) {
317
+        if (!$this->isAPI) {
318 318
             if ($entity) {
319 319
                 return Redirect::to($this->routeIndex)->with('message', __('repository-generator.success'));
320 320
             }
Please login to merge, or discard this patch.
src/GeneratorServiceProvider.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@
 block discarded – undo
23 23
         }
24 24
 
25 25
         $this->publishes([
26
-            __DIR__.'/config' => realpath('config'),
26
+            __DIR__ . '/config' => realpath('config'),
27 27
         ], 'repository-generator');
28 28
 
29 29
         if (null === $this->app['config']->get('repository')) {
30
-            $this->app['config']->set('repository', require __DIR__.'/config/repository.php');
30
+            $this->app['config']->set('repository', require __DIR__ . '/config/repository.php');
31 31
         }
32
-        $this->mergeConfigFrom(__DIR__.'/config/repository.php', 'repository-config');
33
-        $resourcesPath = realpath(__DIR__.'/../../../../resources/');
34
-        $stubPath = realpath(__DIR__.'/../stubs');
35
-        $langPath = Config::get('repository.lang_path').'/en';
32
+        $this->mergeConfigFrom(__DIR__ . '/config/repository.php', 'repository-config');
33
+        $resourcesPath = realpath(__DIR__ . '/../../../../resources/');
34
+        $stubPath = realpath(__DIR__ . '/../stubs');
35
+        $langPath = Config::get('repository.lang_path') . '/en';
36 36
         $this->publishes([
37 37
             $stubPath => Config::get('repository.resources_path', $resourcesPath),
38
-            __DIR__.'/lang' => $langPath,
38
+            __DIR__ . '/lang' => $langPath,
39 39
         ], 'repository-stub');
40 40
     }
41 41
 
Please login to merge, or discard this patch.
src/Commands/Generator.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         $file = preg_split(' (/|\\\\) ', (string) $this->argument('name')) ?? [];
65 65
 
66
-        if (! $file) {
66
+        if (!$file) {
67 67
             return 'Something wrong with the inputs !';
68 68
         }
69 69
 
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
         $this->generate($path, $interface, 'Interface');
94 94
         $this->generate($path, $repository, 'Repository');
95 95
 
96
-        $webFile = Config::get('repository.route_path').'/web.php';
96
+        $webFile = Config::get('repository.route_path') . '/web.php';
97 97
         $pluralName = strtolower(Str::plural($this->repoName));
98
-        $controllerPath = $path.'\\'.$this->repoName.'Controller';
98
+        $controllerPath = $path . '\\' . $this->repoName . 'Controller';
99 99
 
100 100
         $webContent = "\nRoute::resource('{$pluralName}', '{$controllerPath}');";
101 101
 
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
         } else {
120 120
             $message = "There is no entity for {$this->repoName}, 
121 121
                         do you want to continue (this will disable form generator) ?";
122
-            if (! $this->confirm($message)) {
122
+            if (!$this->confirm($message)) {
123 123
                 echo 'Dispatch ..';
124 124
                 die;
125 125
             }
126 126
         }
127 127
         $repositoryName = lcfirst($this->repoName);
128
-        $viewsPath = Config::get('repository.resources_path').'/views';
128
+        $viewsPath = Config::get('repository.resources_path') . '/views';
129 129
         $languagePath = Config::get('repository.lang_path');
130 130
 
131 131
         foreach (Config::get('repository.languages') as $lang) {
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
      */
148 148
     public function getEntity($path)
149 149
     {
150
-        $myClass = 'App\Entities\\'.$path.'\\'.$this->repoName;
151
-        if (! class_exists($myClass)) {
150
+        $myClass = 'App\Entities\\' . $path . '\\' . $this->repoName;
151
+        if (!class_exists($myClass)) {
152 152
             return false;
153 153
         }
154 154
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     protected function getStub($type)
168 168
     {
169
-        return file_get_contents(Config::get('repository.stubs_path')."/$type.stub");
169
+        return file_get_contents(Config::get('repository.stubs_path') . "/$type.stub");
170 170
     }
171 171
 
172 172
     /**
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
      */
180 180
     protected function generate($path, $folder, $type, $form = '')
181 181
     {
182
-        $path = $path ? '\\'.$path : '';
182
+        $path = $path ? '\\' . $path : '';
183 183
         $content = $this->getStub($type);
184 184
 
185 185
         if (false === $content) {
186
-            echo 'file '.$type.'.stub is not exist !';
186
+            echo 'file ' . $type . '.stub is not exist !';
187 187
 
188 188
             return false;
189 189
         }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      */
227 227
     public function getFolderOrCreate($path)
228 228
     {
229
-        if (! file_exists($path)) {
229
+        if (!file_exists($path)) {
230 230
             mkdir($path, 0777, true);
231 231
         }
232 232
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     {
246 246
         switch ($type) {
247 247
             case 'Entity':
248
-                $filePath = $this->getFolderOrCreate(Config::get('repository.app_path')."/{$folder}/{$path}");
248
+                $filePath = $this->getFolderOrCreate(Config::get('repository.app_path') . "/{$folder}/{$path}");
249 249
                 $filePath = rtrim($filePath, '/');
250 250
                 $content = "{$filePath}/{$this->repoName}.php";
251 251
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             case 'Request':
255 255
             case 'Repository':
256 256
             case 'Interface':
257
-                $filePath = $this->getFolderOrCreate(Config::get('repository.app_path')."/{$folder}/{$path}");
257
+                $filePath = $this->getFolderOrCreate(Config::get('repository.app_path') . "/{$folder}/{$path}");
258 258
                 $filePath = rtrim($filePath, '/');
259 259
                 $content = "{$filePath}/{$this->repoName}{$type}.php";
260 260
                 break;
@@ -262,14 +262,14 @@  discard block
 block discarded – undo
262 262
             case 'edit':
263 263
             case 'index':
264 264
             case 'show':
265
-                $filePath = $this->getFolderOrCreate($folder.'/'.Str::plural($path)).'/';
265
+                $filePath = $this->getFolderOrCreate($folder . '/' . Str::plural($path)) . '/';
266 266
                 $repoName = lcfirst($type);
267
-                $content = $filePath.$repoName.'.blade.php';
267
+                $content = $filePath . $repoName . '.blade.php';
268 268
                 break;
269 269
             default:
270
-                $filePath = $this->getFolderOrCreate($folder).'/';
270
+                $filePath = $this->getFolderOrCreate($folder) . '/';
271 271
                 $repoName = lcfirst($this->repoName);
272
-                $content = $filePath.$repoName.'.php';
272
+                $content = $filePath . $repoName . '.php';
273 273
         }
274 274
         file_put_contents($content, $template);
275 275
     }
Please login to merge, or discard this patch.
src/config/repository.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
6 6
  * Time: 09:58 am.
7 7
  */
8 8
 return [
9
-    'app_path' => realpath(__DIR__.'/../app/'),
9
+    'app_path' => realpath(__DIR__ . '/../app/'),
10 10
     'route_path' => realpath('routes/'),
11 11
     'resources_path' => realpath('resources'),
12
-    'stubs_path' => realpath('resources').'/stubs',
13
-    'lang_path' => realpath('resources').'/lang',
12
+    'stubs_path' => realpath('resources') . '/stubs',
13
+    'lang_path' => realpath('resources') . '/lang',
14 14
     'config_path' => realpath('config'),
15 15
 
16 16
     //relative to app path
Please login to merge, or discard this patch.