Passed
Push — master ( 1c9f81...405923 )
by Yassine
06:33
created
src/mailEclipse.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -462,9 +462,11 @@
 block discarded – undo
462 462
 
463 463
         if (! file_exists(config('maileclipse.mailables_dir'))):
464 464
 
465
-            return; else:
465
+            return; else {
466
+              :
466 467
 
467 468
             $allFiles = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(config('maileclipse.mailables_dir')));
469
+            }
468 470
         $phpFiles = new RegexIterator($allFiles, '/\.php$/');
469 471
         $i = 0;
470 472
 
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
         $template = self::getTemplates()
40 40
             ->where('template_slug', $templateSlug)->first();
41 41
 
42
-        if (! is_null($template)) {
43
-            self::saveTemplates(self::getTemplates()->reject(function ($value, $key) use ($template) {
42
+        if (!is_null($template)) {
43
+            self::saveTemplates(self::getTemplates()->reject(function($value, $key) use ($template) {
44 44
                 return $value->template_slug == $template->template_slug;
45 45
             }));
46 46
 
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
     public static function getTemplatesFile()
65 65
     {
66 66
         $file = config('maileclipse.mailables_dir').'templates.json';
67
-        if (! file_exists($file)) {
68
-            if (! file_exists(config('maileclipse.mailables_dir'))) {
67
+        if (!file_exists($file)) {
68
+            if (!file_exists(config('maileclipse.mailables_dir'))) {
69 69
                 mkdir(config('maileclipse.mailables_dir'));
70 70
             }
71 71
             file_put_contents($file, '[]');
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
         $template = self::getTemplates()
85 85
             ->where('template_slug', $request->templateslug)->first();
86 86
 
87
-        if (! is_null($template)) {
88
-            if (! preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->title)) {
87
+        if (!is_null($template)) {
88
+            if (!preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->title)) {
89 89
                 return response()->json([
90 90
                     'status' => 'failed',
91 91
                     'message' => 'Template name not valid',
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
             // Update
111 111
             //
112
-            $oldForm = self::getTemplates()->reject(function ($value, $key) use ($template) {
112
+            $oldForm = self::getTemplates()->reject(function($value, $key) use ($template) {
113 113
                 return $value->template_slug == $template->template_slug;
114 114
             });
115 115
             $newForm = array_merge($oldForm->toArray(), [array_merge((array) $template, [
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         $template = self::getTemplates()
151 151
             ->where('template_slug', $templateSlug)->first();
152 152
 
153
-        if (! is_null($template)) {
153
+        if (!is_null($template)) {
154 154
             $template_view = self::$view_namespace.'::templates.'.$template->template_slug;
155 155
             $template_plaintext_view = $template_view.'_plain_text';
156 156
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
     public static function createTemplate($request)
189 189
     {
190
-        if (! preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->template_name)) {
190
+        if (!preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->template_name)) {
191 191
             return response()->json([
192 192
 
193 193
                 'status' => 'error',
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
         $templatename = Str::camel(preg_replace('/\s+/', '_', $request->template_name));
202 202
 
203
-        if (! view()->exists($view) && ! self::getTemplates()->contains('template_slug', '=', $templatename)) {
203
+        if (!view()->exists($view) && !self::getTemplates()->contains('template_slug', '=', $templatename)) {
204 204
             self::saveTemplates(self::getTemplates()
205 205
                 ->push([
206 206
                     'template_name' => $request->template_name,
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
             $dir = resource_path('views/vendor/'.self::$view_namespace.'/templates');
215 215
 
216
-            if (! \File::isDirectory($dir)) {
216
+            if (!\File::isDirectory($dir)) {
217 217
                 \File::makeDirectory($dir, 0755, true);
218 218
             }
219 219
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 
338 338
         $replaced = self::templateComponentReplace($content);
339 339
 
340
-        if (! $save) {
340
+        if (!$save) {
341 341
             return $replaced;
342 342
         }
343 343
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             if ($template) {
357 357
                 $instance = null;
358 358
             } else {
359
-                if (! is_null(self::handleMailableViewDataArgs($namespace))) {
359
+                if (!is_null(self::handleMailableViewDataArgs($namespace))) {
360 360
                     $instance = self::handleMailableViewDataArgs($namespace);
361 361
                 } else {
362 362
                     $instance = new $namespace;
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
 
385 385
         $templateData = collect($mailable->first())->only(['markdown', 'view_path', 'text_view_path', 'text_view', 'view_data', 'data', 'namespace'])->all();
386 386
 
387
-        $templateExists = ! is_null($templateData['view_path']);
388
-        $textTemplateExists = ! is_null($templateData['text_view_path']);
387
+        $templateExists = !is_null($templateData['view_path']);
388
+        $textTemplateExists = !is_null($templateData['text_view_path']);
389 389
 
390 390
         if ($templateExists) {
391 391
             $viewPathParams = collect($templateData)->union([
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
                 'text_template' => $textTemplateExists ? file_get_contents($templateData['text_view_path']) : null,
394 394
                 'template' => file_get_contents($templateData['view_path']),
395 395
                 'markdowned_template' => self::markdownedTemplate($templateData['view_path']),
396
-                'template_name' => ! is_null($templateData['markdown']) ? $templateData['markdown'] : $templateData['data']->view,
397
-                'is_markdown' => ! is_null($templateData['markdown']) ? true : false,
396
+                'template_name' => !is_null($templateData['markdown']) ? $templateData['markdown'] : $templateData['data']->view,
397
+                'is_markdown' => !is_null($templateData['markdown']) ? true : false,
398 398
                 // 'text_template' => file_get_contents($templateData['text_view_path']),
399 399
 
400 400
             ])->all();
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
     {
410 410
         $name = ucwords(Str::camel(preg_replace('/\s+/', '_', $request->input('name'))));
411 411
 
412
-        if (! self::getMailable('name', $name)->isEmpty() && ! $request->has('force')) {
412
+        if (!self::getMailable('name', $name)->isEmpty() && !$request->has('force')) {
413 413
             // return redirect()->route('createMailable')->with('error', 'mailable already exists! to overide it enable force option.');
414 414
             //
415 415
             return response()->json([
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
     {
462 462
         $fqcns = [];
463 463
 
464
-        if (! file_exists(config('maileclipse.mailables_dir'))):
464
+        if (!file_exists(config('maileclipse.mailables_dir'))):
465 465
 
466 466
             return; else:
467 467
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
             $tokens = token_get_all($content);
476 476
             $namespace = '';
477 477
             for ($index = 0; isset($tokens[$index]); $index++) {
478
-                if (! isset($tokens[$index][0])) {
478
+                if (!isset($tokens[$index][0])) {
479 479
                     continue;
480 480
                 }
481 481
                 if (T_NAMESPACE === $tokens[$index][0]) {
@@ -491,13 +491,13 @@  discard block
 block discarded – undo
491 491
 
492 492
                     $mailableClass = $namespace.'\\'.$tokens[$index][1];
493 493
 
494
-                    if (! self::mailable_exists($mailableClass)) {
494
+                    if (!self::mailable_exists($mailableClass)) {
495 495
                         continue;
496 496
                     }
497 497
 
498 498
                     $mailable_data = self::buildMailable($mailableClass);
499 499
 
500
-                    if (! is_null(self::handleMailableViewDataArgs($mailableClass))) {
500
+                    if (!is_null(self::handleMailableViewDataArgs($mailableClass))) {
501 501
                         $mailable_view_data = self::getMailableViewData(self::handleMailableViewDataArgs($mailableClass), $mailable_data);
502 502
                     } else {
503 503
                         $mailable_view_data = self::getMailableViewData(new $mailableClass, $mailable_data);
@@ -518,16 +518,16 @@  discard block
 block discarded – undo
518 518
                     $fqcns[$i]['view_path'] = null;
519 519
                     $fqcns[$i]['text_view_path'] = null;
520 520
 
521
-                    if (! is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) {
521
+                    if (!is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) {
522 522
                         $fqcns[$i]['view_path'] = View($fqcns[$i]['markdown'])->getPath();
523 523
                     }
524 524
 
525
-                    if (! is_null($fqcns[$i]['data'])) {
526
-                        if (! is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) {
525
+                    if (!is_null($fqcns[$i]['data'])) {
526
+                        if (!is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) {
527 527
                             $fqcns[$i]['view_path'] = View($fqcns[$i]['data']->view)->getPath();
528 528
                         }
529 529
 
530
-                        if (! is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) {
530
+                        if (!is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) {
531 531
                             $fqcns[$i]['text_view_path'] = View($fqcns[$i]['data']->textView)->getPath();
532 532
                             $fqcns[$i]['text_view'] = $fqcns[$i]['data']->textView;
533 533
                         }
@@ -540,10 +540,10 @@  discard block
 block discarded – undo
540 540
             }
541 541
         }
542 542
 
543
-        $collection = collect($fqcns)->map(function ($mailable) {
543
+        $collection = collect($fqcns)->map(function($mailable) {
544 544
             return $mailable;
545
-        })->reject(function ($object) {
546
-            return ! method_exists($object['namespace'], 'build');
545
+        })->reject(function($object) {
546
+            return !method_exists($object['namespace'], 'build');
547 547
         });
548 548
 
549 549
         // return $collection->all();
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 
570 570
             $eloquentFactory = app(EloquentFactory::class);
571 571
 
572
-            $args = collect($params)->map(function ($param) {
572
+            $args = collect($params)->map(function($param) {
573 573
                 if ($param->getType() !== null) {
574 574
                     if (class_exists($param->getType()->getName())) {
575 575
                         $parameters = [
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 
620 620
             $reflector = new ReflectionClass($mailable);
621 621
 
622
-            if (! $args->isEmpty()) {
622
+            if (!$args->isEmpty()) {
623 623
                 $foo = $reflector->newInstanceArgs($filteredparams);
624 624
 
625 625
                 return $foo;
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 
665 665
         $mailableData = collect($classProps)->merge($withFuncData);
666 666
 
667
-        $data = $mailableData->map(function ($parameter) use ($mailable_data) {
667
+        $data = $mailableData->map(function($parameter) use ($mailable_data) {
668 668
             return [
669 669
                 'key' => $parameter,
670 670
                 'value' => property_exists($mailable_data, $parameter) ? $mailable_data->$parameter : null,
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 
698 698
     protected static function mailable_exists($mailable)
699 699
     {
700
-        if (! class_exists($mailable)) {
700
+        if (!class_exists($mailable)) {
701 701
             return false;
702 702
         }
703 703
 
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
     public static function buildMailable($instance, $type = 'call')
723 723
     {
724 724
         if ($type == 'call') {
725
-            if (! is_null(self::handleMailableViewDataArgs($instance))) {
725
+            if (!is_null(self::handleMailableViewDataArgs($instance))) {
726 726
                 return Container::getInstance()->call([self::handleMailableViewDataArgs($instance), 'build']);
727 727
             }
728 728
 
@@ -734,17 +734,17 @@  discard block
 block discarded – undo
734 734
 
735 735
     public static function renderPreview($simpleview, $view, $template = false, $instance = null)
736 736
     {
737
-        if (! View::exists($view)) {
737
+        if (!View::exists($view)) {
738 738
             return;
739 739
         }
740 740
 
741
-        if (! $template) {
741
+        if (!$template) {
742 742
             $obj = self::buildMailable($instance);
743 743
             $viewData = $obj->viewData;
744 744
             $_data = array_merge($instance->buildViewData(), $viewData);
745 745
 
746 746
             foreach ($_data as $key => $value) {
747
-                if (! is_object($value)) {
747
+                if (!is_object($value)) {
748 748
                     $_data[$key] = '<span class="maileclipse-key" title="Variable">'.$key.'</span>';
749 749
                 }
750 750
             }
Please login to merge, or discard this patch.
src/Http/Controllers/MailablesController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $templateData = mailEclipse::getMailableTemplateData($name);
60 60
 
61
-        if (! $templateData) {
61
+        if (!$templateData) {
62 62
             return redirect()->route('viewMailable', ['name' => $name]);
63 63
         }
64 64
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
         $resource = $mailable->first();
107 107
 
108
-        if (! is_null(mailEclipse::handleMailableViewDataArgs($resource['namespace']))) {
108
+        if (!is_null(mailEclipse::handleMailableViewDataArgs($resource['namespace']))) {
109 109
             // $instance = new $resource['namespace'];
110 110
             //
111 111
             $instance = mailEclipse::handleMailableViewDataArgs($resource['namespace']);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             return 'View not found';
118 118
         }
119 119
 
120
-        $view = ! is_null($resource['markdown']) ? $resource['markdown'] : $resource['data']->view;
120
+        $view = !is_null($resource['markdown']) ? $resource['markdown'] : $resource['data']->view;
121 121
 
122 122
         if (view()->exists($view)) {
123 123
             try {
Please login to merge, or discard this patch.
src/Http/routes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 Route::get('/', 'MailablesController@toMailablesList');
4 4
 
5
-Route::group(['prefix' => 'templates'], function () {
5
+Route::group(['prefix' => 'templates'], function() {
6 6
     Route::get('/', 'TemplatesController@index')->name('templateList');
7 7
     Route::get('new', 'TemplatesController@select')->name('selectNewTemplate');
8 8
     Route::get('new/{type}/{name}/{skeleton}', 'TemplatesController@new')->name('newTemplate');
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     Route::post('preview', 'TemplatesController@previewTemplateMarkdownView')->name('previewTemplateMarkdownView');
14 14
 });
15 15
 
16
-Route::group(['prefix' => 'mailables'], function () {
16
+Route::group(['prefix' => 'mailables'], function() {
17 17
     Route::get('/', 'MailablesController@index')->name('mailableList');
18 18
     Route::get('view/{name}', 'MailablesController@viewMailable')->name('viewMailable');
19 19
     Route::get('edit/template/{name}', 'MailablesController@editMailable')->name('editMailable');
Please login to merge, or discard this patch.
src/mailEclipseServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      */
34 34
     private function registerRoutes()
35 35
     {
36
-        Route::group($this->routeConfiguration(), function () {
36
+        Route::group($this->routeConfiguration(), function() {
37 37
             $this->loadRoutesFrom(__DIR__.'/Http/routes.php');
38 38
         });
39 39
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $this->mergeConfigFrom(__DIR__.'/../config/maileclipse.php', 'maileclipse');
63 63
 
64 64
         // Register the service the package provides.
65
-        $this->app->singleton('maileclipse', function ($app) {
65
+        $this->app->singleton('maileclipse', function($app) {
66 66
             return new mailEclipse;
67 67
         });
68 68
     }
Please login to merge, or discard this patch.
config/maileclipse.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     |
71 71
     */
72 72
 
73
-   'skeletons' => [
73
+    'skeletons' => [
74 74
 
75 75
         'html' => [
76 76
 
@@ -244,6 +244,6 @@  discard block
 block discarded – undo
244 244
                 'welcome',
245 245
             ],
246 246
         ],
247
-   ],
247
+    ],
248 248
 
249 249
 ];
Please login to merge, or discard this patch.