Completed
Push — master ( ea364c...642cde )
by
unknown
19s queued 12s
created
src/MailEclipseServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     private function registerRoutes()
36 36
     {
37
-        Route::group($this->routeConfiguration(), function () {
37
+        Route::group($this->routeConfiguration(), function() {
38 38
             $this->loadRoutesFrom(__DIR__.'/Http/routes.php');
39 39
         });
40 40
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $this->mergeConfigFrom(__DIR__.'/../config/maileclipse.php', 'maileclipse');
64 64
 
65 65
         // Register the service the package provides.
66
-        $this->app->singleton('maileclipse', function ($app) {
66
+        $this->app->singleton('maileclipse', function($app) {
67 67
             return new MailEclipse;
68 68
         });
69 69
     }
Please login to merge, or discard this patch.
src/Http/Controllers/MailablesController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
     {
60 60
         $templateData = MailEclipse::getMailableTemplateData($name);
61 61
 
62
-        if (! $templateData) {
62
+        if (!$templateData) {
63 63
             return redirect()->route('viewMailable', ['name' => $name]);
64 64
         }
65 65
 
Please login to merge, or discard this patch.
src/MailEclipseMailables.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $fqcns = [];
32 32
 
33
-        if (! file_exists(config('maileclipse.mailables_dir'))) {
33
+        if (!file_exists(config('maileclipse.mailables_dir'))) {
34 34
             return;
35 35
         } else {
36 36
             $allFiles = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(config('maileclipse.mailables_dir')));
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                 $tokens = token_get_all($content);
44 44
                 $namespace = '';
45 45
                 for ($index = 0; isset($tokens[$index]); $index++) {
46
-                    if (! isset($tokens[$index][0])) {
46
+                    if (!isset($tokens[$index][0])) {
47 47
                         continue;
48 48
                     }
49 49
                     if (T_NAMESPACE === $tokens[$index][0]) {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
                         $mailableClass = $namespace.'\\'.$tokens[$index][1];
61 61
 
62
-                        if (! MailEclipse::mailable_exists($mailableClass)) {
62
+                        if (!MailEclipse::mailable_exists($mailableClass)) {
63 63
                             continue;
64 64
                         }
65 65
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
                         $mailable_data = MailEclipse::buildMailable($mailableClass);
73 73
 
74
-                        if (! is_null(MailEclipse::handleMailableViewDataArgs($mailableClass))) {
74
+                        if (!is_null(MailEclipse::handleMailableViewDataArgs($mailableClass))) {
75 75
                             $mailable_view_data = MailEclipse::getMailableViewData(MailEclipse::handleMailableViewDataArgs($mailableClass), $mailable_data);
76 76
                         } else {
77 77
                             $mailable_view_data = MailEclipse::getMailableViewData(new $mailableClass, $mailable_data);
@@ -92,16 +92,16 @@  discard block
 block discarded – undo
92 92
                         $fqcns[$i]['view_path'] = null;
93 93
                         $fqcns[$i]['text_view_path'] = null;
94 94
 
95
-                        if (! is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) {
95
+                        if (!is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) {
96 96
                             $fqcns[$i]['view_path'] = View($fqcns[$i]['markdown'])->getPath();
97 97
                         }
98 98
 
99
-                        if (! is_null($fqcns[$i]['data'])) {
100
-                            if (! is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) {
99
+                        if (!is_null($fqcns[$i]['data'])) {
100
+                            if (!is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) {
101 101
                                 $fqcns[$i]['view_path'] = View($fqcns[$i]['data']->view)->getPath();
102 102
                             }
103 103
 
104
-                            if (! is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) {
104
+                            if (!is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) {
105 105
                                 $fqcns[$i]['text_view_path'] = View($fqcns[$i]['data']->textView)->getPath();
106 106
                                 $fqcns[$i]['text_view'] = $fqcns[$i]['data']->textView;
107 107
                             }
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
                 }
115 115
             }
116 116
 
117
-            $collection = collect($fqcns)->map(function ($mailable) {
117
+            $collection = collect($fqcns)->map(function($mailable) {
118 118
                 return $mailable;
119
-            })->reject(function ($object) {
120
-                return ! method_exists($object['namespace'], 'build');
119
+            })->reject(function($object) {
120
+                return !method_exists($object['namespace'], 'build');
121 121
             });
122 122
 
123 123
             return $collection;
Please login to merge, or discard this patch.
src/Http/routes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 Route::get('/', 'MailablesController@toMailablesList');
6 6
 
7
-Route::group(['prefix' => 'templates'], function () {
7
+Route::group(['prefix' => 'templates'], function() {
8 8
     Route::get('/', 'TemplatesController@index')->name('templateList');
9 9
     Route::get('new', 'TemplatesController@select')->name('selectNewTemplate');
10 10
     Route::get('new/{type}/{name}/{skeleton}', 'TemplatesController@new')->name('newTemplate');
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     Route::post('preview', 'TemplatesController@previewTemplateMarkdownView')->name('previewTemplateMarkdownView');
16 16
 });
17 17
 
18
-Route::group(['prefix' => 'mailables'], function () {
18
+Route::group(['prefix' => 'mailables'], function() {
19 19
     Route::get('/', 'MailablesController@index')->name('mailableList');
20 20
     Route::get('view/{name}', 'MailablesController@viewMailable')->name('viewMailable');
21 21
     Route::get('edit/template/{name}', 'MailablesController@editMailable')->name('editMailable');
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     Route::post('new', 'MailablesController@generateMailable')->name('generateMailable');
26 26
     Route::post('delete', 'MailablesController@delete')->name('deleteMailable');
27 27
 
28
-    Route::group(['prefix' => 'preview'], function () {
28
+    Route::group(['prefix' => 'preview'], function() {
29 29
         Route::post('template', 'MailablesPreviewController@markdownView')->name('previewMarkdownView');
30 30
         Route::get('template/previewerror', 'MailablesPreviewController@previewError')->name('templatePreviewError');
31 31
         Route::get('{name}', 'MailablesPreviewController@mailable')->name('previewMailable');
Please login to merge, or discard this patch.
src/MailEclipse.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             ->where('template_slug', $templateSlug)->first();
73 73
 
74 74
         if ($template !== null) {
75
-            self::saveTemplates(self::getTemplates()->reject(function ($value) use ($template) {
75
+            self::saveTemplates(self::getTemplates()->reject(function($value) use ($template) {
76 76
                 return $value->template_slug === $template->template_slug;
77 77
             }));
78 78
 
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
     public static function getTemplatesFile()
101 101
     {
102 102
         $file = config('maileclipse.mailables_dir').'templates.json';
103
-        if (! file_exists($file)) {
104
-            if (! file_exists(config('maileclipse.mailables_dir'))) {
105
-                if (! mkdir($concurrentDirectory = config('maileclipse.mailables_dir')) && ! is_dir($concurrentDirectory)) {
103
+        if (!file_exists($file)) {
104
+            if (!file_exists(config('maileclipse.mailables_dir'))) {
105
+                if (!mkdir($concurrentDirectory = config('maileclipse.mailables_dir')) && !is_dir($concurrentDirectory)) {
106 106
                     throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
107 107
                 }
108 108
             }
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             ->where('template_slug', $request->templateslug)->first();
133 133
 
134 134
         if ($template !== null) {
135
-            if (! preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->title)) {
135
+            if (!preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->title)) {
136 136
                 return response()->json([
137 137
                     'status' => 'failed',
138 138
                     'message' => 'Template name not valid',
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             }
152 152
 
153 153
             // Update
154
-            $oldForm = self::getTemplates()->reject(function ($value) use ($template) {
154
+            $oldForm = self::getTemplates()->reject(function($value) use ($template) {
155 155
                 return $value->template_slug === $template->template_slug;
156 156
             });
157 157
             $newForm = array_merge($oldForm->toArray(), [array_merge((array) $template, [
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      */
235 235
     public static function createTemplate($request): JsonResponse
236 236
     {
237
-        if (! preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->template_name)) {
237
+        if (!preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->template_name)) {
238 238
             return response()->json([
239 239
                 'status' => 'error',
240 240
                 'message' => 'Template name not valid',
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         $view = self::VIEW_NAMESPACE.'::templates.'.$request->template_name;
246 246
         $templateName = Str::camel(preg_replace('/\s+/', '_', $request->template_name));
247 247
 
248
-        if (! view()->exists($view) && ! self::getTemplates()->contains('template_slug', '=', $templateName)) {
248
+        if (!view()->exists($view) && !self::getTemplates()->contains('template_slug', '=', $templateName)) {
249 249
             self::saveTemplates(self::getTemplates()
250 250
                 ->push([
251 251
                     'template_name' => $request->template_name,
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
             $dir = resource_path('views/vendor/'.self::VIEW_NAMESPACE.'/templates');
260 260
 
261
-            if (! File::isDirectory($dir)) {
261
+            if (!File::isDirectory($dir)) {
262 262
                 File::makeDirectory($dir, 0755, true);
263 263
             }
264 264
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 
299 299
         $replaced = Replacer::toBlade($content);
300 300
 
301
-        if (! $save) {
301
+        if (!$save) {
302 302
             return $replaced;
303 303
         }
304 304
 
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
             ]);
396 396
         }
397 397
 
398
-        if (! $request->has('force') && ! self::getMailable('name', $name)->isEmpty()) {
398
+        if (!$request->has('force') && !self::getMailable('name', $name)->isEmpty()) {
399 399
             return response()->json([
400 400
                 'status' => 'error',
401 401
                 'message' => 'This mailable name already exists. names should be unique! to override it, enable "force" option.',
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
     {
449 449
         $fqcns = [];
450 450
 
451
-        if (! file_exists(config('maileclipse.mailables_dir'))) {
451
+        if (!file_exists(config('maileclipse.mailables_dir'))) {
452 452
             return;
453 453
         } else {
454 454
             $allFiles = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(config('maileclipse.mailables_dir')));
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
                 $tokens = token_get_all($content);
462 462
                 $namespace = '';
463 463
                 for ($index = 0; isset($tokens[$index]); $index++) {
464
-                    if (! isset($tokens[$index][0])) {
464
+                    if (!isset($tokens[$index][0])) {
465 465
                         continue;
466 466
                     }
467 467
                     if (T_NAMESPACE === $tokens[$index][0]) {
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 
478 478
                         $mailableClass = $namespace.'\\'.$tokens[$index][1];
479 479
 
480
-                        if (! self::mailable_exists($mailableClass)) {
480
+                        if (!self::mailable_exists($mailableClass)) {
481 481
                             continue;
482 482
                         }
483 483
 
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 
490 490
                         $mailable_data = self::buildMailable($mailableClass);
491 491
 
492
-                        if (! is_null(self::handleMailableViewDataArgs($mailableClass))) {
492
+                        if (!is_null(self::handleMailableViewDataArgs($mailableClass))) {
493 493
                             $mailable_view_data = self::getMailableViewData(self::handleMailableViewDataArgs($mailableClass), $mailable_data);
494 494
                         } else {
495 495
                             $mailable_view_data = self::getMailableViewData(new $mailableClass, $mailable_data);
@@ -510,16 +510,16 @@  discard block
 block discarded – undo
510 510
                         $fqcns[$i]['view_path'] = null;
511 511
                         $fqcns[$i]['text_view_path'] = null;
512 512
 
513
-                        if (! is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) {
513
+                        if (!is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) {
514 514
                             $fqcns[$i]['view_path'] = View($fqcns[$i]['markdown'])->getPath();
515 515
                         }
516 516
 
517
-                        if (! is_null($fqcns[$i]['data'])) {
518
-                            if (! is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) {
517
+                        if (!is_null($fqcns[$i]['data'])) {
518
+                            if (!is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) {
519 519
                                 $fqcns[$i]['view_path'] = View($fqcns[$i]['data']->view)->getPath();
520 520
                             }
521 521
 
522
-                            if (! is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) {
522
+                            if (!is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) {
523 523
                                 $fqcns[$i]['text_view_path'] = View($fqcns[$i]['data']->textView)->getPath();
524 524
                                 $fqcns[$i]['text_view'] = $fqcns[$i]['data']->textView;
525 525
                             }
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
                 }
533 533
             }
534 534
 
535
-            $collection = collect($fqcns)->map(function ($mailable) {
535
+            $collection = collect($fqcns)->map(function($mailable) {
536 536
                 return $mailable;
537
-            })->reject(function ($object) {
538
-                return ! method_exists($object['namespace'], 'build');
537
+            })->reject(function($object) {
538
+                return !method_exists($object['namespace'], 'build');
539 539
             });
540 540
 
541 541
             return $collection;
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 
560 560
             $eloquentFactory = app(EloquentFactory::class);
561 561
 
562
-            $args = collect($params)->map(function ($param) {
562
+            $args = collect($params)->map(function($param) {
563 563
                 if ($param->getType() !== null) {
564 564
                     if (class_exists($param->getType()->getName())) {
565 565
                         $parameters = [
@@ -631,17 +631,17 @@  discard block
 block discarded – undo
631 631
         $reflection = collect($params)->where('name', $arg)->first()->getType();
632 632
 
633 633
         if (version_compare(phpversion(), '7.1', '>=')) {
634
-            $type = ! is_null($reflection)
634
+            $type = !is_null($reflection)
635 635
                 ? self::TYPES[$reflection->getName()]
636 636
                 : null;
637 637
         } else {
638
-            $type = ! is_null($reflection)
638
+            $type = !is_null($reflection)
639 639
                 ? self::TYPES[/** @scrutinizer ignore-deprecated */ $reflection->__toString()]
640 640
                 : null;
641 641
         }
642 642
 
643 643
         try {
644
-            return ! is_null($type)
644
+            return !is_null($type)
645 645
                     ? $type
646 646
                     : new Mocked($arg, \ReeceM\Mocker\Utils\VarStore::singleton());
647 647
         } catch (\Exception $e) {
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 
673 673
         foreach ($properties as $prop) {
674 674
             if ($prop->class == $data->getName() || $prop->class == get_parent_class($data->getName()) &&
675
-                    get_parent_class($data->getName()) != 'Illuminate\Mail\Mailable' && ! $prop->isStatic()) {
675
+                    get_parent_class($data->getName()) != 'Illuminate\Mail\Mailable' && !$prop->isStatic()) {
676 676
                 $allProps[] = $prop->name;
677 677
             }
678 678
         }
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 
692 692
         $mailableData = collect($classProps)->merge($withFuncData);
693 693
 
694
-        $data = $mailableData->map(function ($parameter) use ($mailable_data) {
694
+        $data = $mailableData->map(function($parameter) use ($mailable_data) {
695 695
             return [
696 696
                 'key' => $parameter,
697 697
                 'value' => property_exists($mailable_data, $parameter) ? $mailable_data->$parameter : null,
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
      */
739 739
     protected static function mailable_exists($mailable): bool
740 740
     {
741
-        if (! class_exists($mailable)) {
741
+        if (!class_exists($mailable)) {
742 742
             return false;
743 743
         }
744 744
 
@@ -796,17 +796,17 @@  discard block
 block discarded – undo
796 796
      */
797 797
     public static function renderPreview($simpleview, $view, $template = false, $instance = null)
798 798
     {
799
-        if (! View::exists($view)) {
799
+        if (!View::exists($view)) {
800 800
             return;
801 801
         }
802 802
 
803
-        if (! $template) {
803
+        if (!$template) {
804 804
             $obj = self::buildMailable($instance);
805 805
             $viewData = $obj->viewData;
806 806
             $_data = array_merge($instance->buildViewData(), $viewData);
807 807
 
808 808
             foreach ($_data as $key => $value) {
809
-                if (! is_object($value)) {
809
+                if (!is_object($value)) {
810 810
                     $_data[$key] = '<span class="maileclipse-key" title="Variable">'.$key.'</span>';
811 811
                 }
812 812
             }
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
         /**
873 873
          * Removal of reserved keywords.
874 874
          */
875
-        if (! preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/', $name) ||
875
+        if (!preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/', $name) ||
876 876
             substr_compare($name, $suffix, -strlen($suffix), strlen($suffix), true) !== 0
877 877
         ) {
878 878
             return false;
Please login to merge, or discard this patch.
src/Http/Controllers/MailablesPreviewController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
             $instance = new $resource['namespace'];
49 49
         }
50 50
 
51
-        $view = ! is_null($resource['markdown'])
51
+        $view = !is_null($resource['markdown'])
52 52
             ? $resource['markdown']
53 53
             : $resource['data']->view;
54 54
 
Please login to merge, or discard this patch.
src/Actions/DeleteMailable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     {
11 11
         $mailableFile = config('maileclipse.mailables_dir').'/'.$request['mailablename'].'.php';
12 12
 
13
-        if (! File::exists($mailableFile)) {
13
+        if (!File::exists($mailableFile)) {
14 14
             return [
15 15
                 'status' => 'error',
16 16
                 'message' => 'Mailable '.$request['mailablename'].' does not exist',
Please login to merge, or discard this patch.
src/Actions/CreateMailable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
             ];
26 26
         }
27 27
 
28
-        if (! MailEclipse::getMailable('name', $parameters['name'])->isEmpty() && ! isset($parameters['force'])) {
28
+        if (!MailEclipse::getMailable('name', $parameters['name'])->isEmpty() && !isset($parameters['force'])) {
29 29
             return [
30 30
                 'status' => 'error',
31 31
                 'message' => 'This mailable name already exists. names should be unique! to override it, enable "force" option.',
Please login to merge, or discard this patch.
src/Utils/Replacer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,20 +97,20 @@
 block discarded – undo
97 97
     {
98 98
         $components = config('maileclipse.components');
99 99
 
100
-        $this->bladeMatchPatterns = array_map(function ($component) {
100
+        $this->bladeMatchPatterns = array_map(function($component) {
101 101
             return "/@${component}/i";
102 102
         }, $components);
103 103
 
104
-        $this->bladeReplacePatterns = array_map(function ($component) {
104
+        $this->bladeReplacePatterns = array_map(function($component) {
105 105
             return "[${component}]: # ";
106 106
         }, $components);
107 107
 
108 108
 
109
-        $this->editorMatchPatterns = array_map(function ($component) {
109
+        $this->editorMatchPatterns = array_map(function($component) {
110 110
             return "/\[${component}]:\s?#\s?/i";
111 111
         }, $components);
112 112
 
113
-        $this->editorReplacePatterns = array_map(function ($component) {
113
+        $this->editorReplacePatterns = array_map(function($component) {
114 114
             return "@${component}";
115 115
         }, $components);
116 116
     }
Please login to merge, or discard this patch.