Passed
Push — master ( 717519...ee4194 )
by Hamzah
03:20
created
src/Commands/Generator.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,6 @@
 block discarded – undo
51 51
     /**
52 52
      * Execute the console command.
53 53
      *
54
-
55 54
      */
56 55
     public function handle()
57 56
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     public function handle()
57 57
     {
58 58
 
59
-        $file = explode("/", (string)$this->argument('name'));
59
+        $file = explode("/", (string) $this->argument('name'));
60 60
 
61 61
         $this->repoName = $file[count($file) - 1];
62 62
         unset($file[count($file) - 1]);
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
             $this->repoNamespace = $file[count($file) - 1];
69 69
             $this->repoNamespace = implode("\\", $file);
70 70
         }
71
-        $model= str_plural(\Config::get('repository.model'));
72
-        $interface= str_plural(\Config::get('repository.interface'));
73
-        $repository= str_plural(\Config::get('repository.repository'));
71
+        $model = str_plural(\Config::get('repository.model'));
72
+        $interface = str_plural(\Config::get('repository.interface'));
73
+        $repository = str_plural(\Config::get('repository.repository'));
74 74
 
75 75
         $this->generate($path, \Config::get('repository.controllers_path'), 'Controller');
76 76
         $this->generate($path, $model, 'Entity');
Please login to merge, or discard this patch.
src/config/repository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 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
-    'resources_path' => realpath(__DIR__.'/../vendor/shamaseen/repository-generator/stubs'),
11
+    'resources_path' => realpath(__DIR__ . '/../vendor/shamaseen/repository-generator/stubs'),
12 12
 
13 13
     //relative to app path
14 14
     'interface' => 'Interface',
Please login to merge, or discard this patch.
src/GeneratorServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,17 +26,17 @@
 block discarded – undo
26 26
         }
27 27
 
28 28
         $this->publishes([
29
-            __DIR__.'/config' => realpath('config'),
30
-        ],'repository-config');
29
+            __DIR__ . '/config' => realpath('config'),
30
+        ], 'repository-config');
31 31
 
32 32
         if ($this->app['config']->get('repository') === null) {
33
-            $this->app['config']->set('repository', require __DIR__.'/config/repository.php');
33
+            $this->app['config']->set('repository', require __DIR__ . '/config/repository.php');
34 34
         }
35
-        $this->mergeConfigFrom(__DIR__.'/config/repository.php', 'repository-config');
35
+        $this->mergeConfigFrom(__DIR__ . '/config/repository.php', 'repository-config');
36 36
 
37 37
         $this->publishes([
38
-            __DIR__ . '/stubs' => \Config::get('repository.resources_path',realpath(__DIR__.'/../../../../resources/'))."/stubs/",
39
-        ],'repository-stub');
38
+            __DIR__ . '/stubs' => \Config::get('repository.resources_path', realpath(__DIR__ . '/../../../../resources/')) . "/stubs/",
39
+        ], 'repository-stub');
40 40
     }
41 41
 
42 42
     /**
Please login to merge, or discard this patch.
src/Bases/AbstractRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function filter($filters = [])
78 78
     {
79
-        $filters= $this->order($filters);
79
+        $filters = $this->order($filters);
80 80
 
81 81
         /** @var Entity $latest */
82 82
         $latest = $this->model->with($this->with);
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *
110 110
      * @return array
111 111
      */
112
-    private function order($filters=[]){
112
+    private function order($filters = []) {
113 113
 
114 114
         if (isset($filters['order'])) {
115 115
             $this->order = $filters['order'];
Please login to merge, or discard this patch.
src/Bases/ContractInterface.php 1 patch
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 
34 34
     /**
35 35
      * @param array $data
36
-     * @param $entityId
36
+     * @param integer $entityId
37 37
      *
38 38
      * @return bool
39 39
      */
40 40
     public function update($entityId, $data = []);
41 41
 
42 42
     /**
43
-     * @param $entityId
43
+     * @param integer $entityId
44 44
      *
45 45
      * @throws \Exception
46 46
      *
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     public function delete($entityId);
50 50
 
51 51
     /**
52
-     * @param $entityId
52
+     * @param integer $entityId
53 53
      * @param array $columns
54 54
      *
55 55
      *  @return Entity
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      * @param int $limit
77 77
      * @param array $filters
78 78
      *
79
-     * @return Paginator
79
+     * @return \Illuminate\Contracts\Pagination\Paginator
80 80
      */
81 81
     public function simplePaginate($limit = 10, $filters = []);
82 82
 
Please login to merge, or discard this patch.
src/Bases/Controller.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         $this->breadcrumbs = new Collection();
58 58
 
59 59
         $language = $request->header('Language', 'en');
60
-        if (! in_array($language, \Config::get('app.locales', []))) {
60
+        if (!in_array($language, \Config::get('app.locales', []))) {
61 61
             $language = 'en';
62 62
         }
63 63
         $limit = $request->get('limit', 10);
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
         $this->interface = $interface;
81 81
         $this->isAPI = $request->expectsJson();
82 82
 
83
-        if (! $this->isAPI) {
83
+        if (!$this->isAPI) {
84 84
             $this->breadcrumbs = new Collection();
85 85
             $this->search = new Collection();
86
-            \View::share('pageTitle', $this->pageTitle.' | '.\Config::get('app.name'));
86
+            \View::share('pageTitle', $this->pageTitle . ' | ' . \Config::get('app.name'));
87 87
             \View::share('breadcrumbs', $this->breadcrumbs);
88 88
             \View::share('menu', $this->menu);
89 89
             \View::share('search', $this->search);
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
     public function index()
102 102
     {
103 103
         $data = $this->interface->simplePaginate($this->limit, $this->request->all());
104
-        if (! $this->isAPI) {
105
-            \View::share('pageTitle', 'List '.$this->pageTitle.' | '.\Config::get('app.name'));
104
+        if (!$this->isAPI) {
105
+            \View::share('pageTitle', 'List ' . $this->pageTitle . ' | ' . \Config::get('app.name'));
106 106
             $this->breadcrumbs->put('index', [
107 107
                 'link' => $this->routeIndex,
108 108
                 'text' => $this->pageTitle,
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
      */
131 131
     public function create()
132 132
     {
133
-        if (! $this->isAPI) {
134
-            \View::share('pageTitle', 'Create '.$this->pageTitle.' | '.\Config::get('app.name'));
133
+        if (!$this->isAPI) {
134
+            \View::share('pageTitle', 'Create ' . $this->pageTitle . ' | ' . \Config::get('app.name'));
135 135
             $this->breadcrumbs->put('create', [
136 136
                 'link' => $this->createRoute,
137 137
                 'text' => trans('common/others.create'),
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     public function baseStore()
152 152
     {
153 153
         $entity = $this->interface->create($this->request->except(['_token', '_method']));
154
-        if (! $this->isAPI) {
154
+        if (!$this->isAPI) {
155 155
             if ($entity) {
156 156
                 return \Redirect::to($this->routeIndex)->with('message', __('messages.success'));
157 157
             }
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
     public function show($entityId)
183 183
     {
184 184
         $entity = $this->interface->find($entityId);
185
-        if (! $this->isAPI) {
186
-            if (! $entity) {
185
+        if (!$this->isAPI) {
186
+            if (!$entity) {
187 187
                 return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found'));
188 188
             }
189
-            \View::share('pageTitle', 'View '.$this->pageTitle.' | '.\Config::get('app.name'));
189
+            \View::share('pageTitle', 'View ' . $this->pageTitle . ' | ' . \Config::get('app.name'));
190 190
             $this->breadcrumbs->put('view', [
191 191
                 'link' => '',
192 192
                 'text' => $entity->name ?? $entity->title ?? __('messages.view'),
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
             return view($this->viewShow, $this->params)
196 196
                 ->with('entity', $entity);
197 197
         }
198
-        if (! $entity) {
198
+        if (!$entity) {
199 199
             return response()->json(null, JsonResponse::HTTP_NOT_FOUND);
200 200
         }
201 201
 
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
     public function edit($entityId)
216 216
     {
217 217
         $entity = $this->interface->find($entityId);
218
-        if (! $this->isAPI) {
219
-            if (! $entity) {
218
+        if (!$this->isAPI) {
219
+            if (!$entity) {
220 220
                 return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found'));
221 221
             }
222 222
             $this->breadcrumbs->put('edit', [
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
             $saved = $this->interface->update($entityId, $this->request->except(['_token', '_method']));
248 248
         }
249 249
 
250
-        if (! $this->isAPI) {
251
-            if (! $entity) {
250
+        if (!$this->isAPI) {
251
+            if (!$entity) {
252 252
                 return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found'));
253 253
             }
254 254
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             return \Redirect::to($this->routeIndex)->with('error', __('messages.not_modified'));
260 260
         }
261 261
 
262
-        if (! $entity) {
262
+        if (!$entity) {
263 263
             return response()->json(null, JsonResponse::HTTP_NOT_FOUND);
264 264
         }
265 265
 
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
         if ($entity) {
290 290
             $deleted = $this->interface->delete($entityId);
291 291
         }
292
-        if (! $this->isAPI) {
293
-            if (! $entity) {
292
+        if (!$this->isAPI) {
293
+            if (!$entity) {
294 294
                 return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found'));
295 295
             }
296 296
             if ($deleted) {
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
     {
323 323
         $entity = $this->interface->restore($entityId);
324 324
 
325
-        if (! $this->isAPI) {
326
-            if (! $entity) {
325
+        if (!$this->isAPI) {
326
+            if (!$entity) {
327 327
                 return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found'));
328 328
             }
329 329
             if ($entity) {
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
             return \Redirect::to($this->routeIndex)->with('error', __('messages.not_modified'));
334 334
         }
335 335
 
336
-        if (! $entity) {
336
+        if (!$entity) {
337 337
             return response()->json(null, JsonResponse::HTTP_NOT_FOUND);
338 338
         }
339 339
 
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
     {
356 356
         $entity = $this->interface->forceDelete($entityId);
357 357
 
358
-        if (! $this->isAPI) {
359
-            if (! $entity) {
358
+        if (!$this->isAPI) {
359
+            if (!$entity) {
360 360
                 return \Redirect::to($this->routeIndex)->with('warning', __('messages.not_found'));
361 361
             }
362 362
             if ($entity) {
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             return \Redirect::to($this->routeIndex)->with('error', __('messages.not_modified'));
367 367
         }
368 368
 
369
-        if (! $entity) {
369
+        if (!$entity) {
370 370
             return response()->json(null, JsonResponse::HTTP_NOT_FOUND);
371 371
         }
372 372
 
Please login to merge, or discard this patch.
src/Bases/Request.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@
 block discarded – undo
29 29
     protected function failedValidation(Validator $validator)
30 30
     {
31 31
 
32
-        if (strpos($this->path(),'api') !== false) {
32
+        if (strpos($this->path(), 'api') !== false) {
33 33
             $errors = (new ValidationException($validator))->errors();
34 34
             throw new HttpResponseException(response()->json(['success' => false, 'errors' => $errors,
35 35
             ], JsonResponse::HTTP_UNPROCESSABLE_ENTITY));
36 36
         }
37 37
     }
38 38
 
39
-    public function rules(){
40
-        \App::setLocale($this->header('Language','en'));
39
+    public function rules() {
40
+        \App::setLocale($this->header('Language', 'en'));
41 41
     }
42 42
 }
Please login to merge, or discard this patch.
src/RepositoryServiceProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@
 block discarded – undo
35 35
         parent::__construct($app);
36 36
 
37 37
         if ($this->app['config']->get('repository') === null) {
38
-            $this->app['config']->set('repository', require __DIR__.'/config/repository.php');
38
+            $this->app['config']->set('repository', require __DIR__ . '/config/repository.php');
39 39
         }
40
-        $interfaces= str_plural(Config::get('repository.interface'));
41
-        $repositories= str_plural(Config::get('repository.repository'));
42
-        $interface= Config::get('repository.interface');
43
-        $repository= Config::get('repository.repository');
40
+        $interfaces = str_plural(Config::get('repository.interface'));
41
+        $repositories = str_plural(Config::get('repository.repository'));
42
+        $interface = Config::get('repository.interface');
43
+        $repository = Config::get('repository.repository');
44 44
 
45 45
         $contractsFolder = realpath(__DIR__ . '/../../../../app/' . $interfaces);
46 46
         if ($contractsFolder) {
Please login to merge, or discard this patch.