Completed
Push — master ( fb798a...9bcf74 )
by
unknown
17s queued 10s
created
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/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/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/MailEclipse.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
         $template = self::getTemplates()
52 52
             ->where('template_slug', $templateSlug)->first();
53 53
 
54
-        if (! is_null($template)) {
55
-            self::saveTemplates(self::getTemplates()->reject(function ($value, $key) use ($template) {
54
+        if (!is_null($template)) {
55
+            self::saveTemplates(self::getTemplates()->reject(function($value, $key) use ($template) {
56 56
                 return $value->template_slug == $template->template_slug;
57 57
             }));
58 58
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
     public static function getTemplatesFile()
77 77
     {
78 78
         $file = config('maileclipse.mailables_dir').'templates.json';
79
-        if (! file_exists($file)) {
80
-            if (! file_exists(config('maileclipse.mailables_dir'))) {
79
+        if (!file_exists($file)) {
80
+            if (!file_exists(config('maileclipse.mailables_dir'))) {
81 81
                 mkdir(config('maileclipse.mailables_dir'));
82 82
             }
83 83
             file_put_contents($file, '[]');
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
         $template = self::getTemplates()
97 97
             ->where('template_slug', $request->templateslug)->first();
98 98
 
99
-        if (! is_null($template)) {
100
-            if (! preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->title)) {
99
+        if (!is_null($template)) {
100
+            if (!preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->title)) {
101 101
                 return response()->json([
102 102
                     'status' => 'failed',
103 103
                     'message' => 'Template name not valid',
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
             // Update
123 123
             //
124
-            $oldForm = self::getTemplates()->reject(function ($value, $key) use ($template) {
124
+            $oldForm = self::getTemplates()->reject(function($value, $key) use ($template) {
125 125
                 return $value->template_slug == $template->template_slug;
126 126
             });
127 127
             $newForm = array_merge($oldForm->toArray(), [array_merge((array) $template, [
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         $template = self::getTemplates()
163 163
             ->where('template_slug', $templateSlug)->first();
164 164
 
165
-        if (! is_null($template)) {
165
+        if (!is_null($template)) {
166 166
             $template_view = self::$view_namespace.'::templates.'.$template->template_slug;
167 167
             $template_plaintext_view = $template_view.'_plain_text';
168 168
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
     public static function createTemplate($request)
201 201
     {
202
-        if (! preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->template_name)) {
202
+        if (!preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->template_name)) {
203 203
             return response()->json([
204 204
 
205 205
                 'status' => 'error',
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
         $templatename = Str::camel(preg_replace('/\s+/', '_', $request->template_name));
214 214
 
215
-        if (! view()->exists($view) && ! self::getTemplates()->contains('template_slug', '=', $templatename)) {
215
+        if (!view()->exists($view) && !self::getTemplates()->contains('template_slug', '=', $templatename)) {
216 216
             self::saveTemplates(self::getTemplates()
217 217
                 ->push([
218 218
                     'template_name' => $request->template_name,
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
             $dir = resource_path('views/vendor/'.self::$view_namespace.'/templates');
227 227
 
228
-            if (! \File::isDirectory($dir)) {
228
+            if (!\File::isDirectory($dir)) {
229 229
                 \File::makeDirectory($dir, 0755, true);
230 230
             }
231 231
 
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 
350 350
         $replaced = self::templateComponentReplace($content);
351 351
 
352
-        if (! $save) {
352
+        if (!$save) {
353 353
             return $replaced;
354 354
         }
355 355
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
             if ($template) {
369 369
                 $instance = null;
370 370
             } else {
371
-                if (! is_null(self::handleMailableViewDataArgs($namespace))) {
371
+                if (!is_null(self::handleMailableViewDataArgs($namespace))) {
372 372
                     $instance = self::handleMailableViewDataArgs($namespace);
373 373
                 } else {
374 374
                     $instance = new $namespace;
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
 
397 397
         $templateData = collect($mailable->first())->only(['markdown', 'view_path', 'text_view_path', 'text_view', 'view_data', 'data', 'namespace'])->all();
398 398
 
399
-        $templateExists = ! is_null($templateData['view_path']);
400
-        $textTemplateExists = ! is_null($templateData['text_view_path']);
399
+        $templateExists = !is_null($templateData['view_path']);
400
+        $textTemplateExists = !is_null($templateData['text_view_path']);
401 401
 
402 402
         if ($templateExists) {
403 403
             $viewPathParams = collect($templateData)->union([
@@ -405,8 +405,8 @@  discard block
 block discarded – undo
405 405
                 'text_template' => $textTemplateExists ? file_get_contents($templateData['text_view_path']) : null,
406 406
                 'template' => file_get_contents($templateData['view_path']),
407 407
                 'markdowned_template' => self::markdownedTemplate($templateData['view_path']),
408
-                'template_name' => ! is_null($templateData['markdown']) ? $templateData['markdown'] : $templateData['data']->view,
409
-                'is_markdown' => ! is_null($templateData['markdown']) ? true : false,
408
+                'template_name' => !is_null($templateData['markdown']) ? $templateData['markdown'] : $templateData['data']->view,
409
+                'is_markdown' => !is_null($templateData['markdown']) ? true : false,
410 410
                 // 'text_template' => file_get_contents($templateData['text_view_path']),
411 411
 
412 412
             ])->all();
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
             ]);
429 429
         }
430 430
 
431
-        if (! self::getMailable('name', $name)->isEmpty() && ! $request->has('force')) {
431
+        if (!self::getMailable('name', $name)->isEmpty() && !$request->has('force')) {
432 432
             // return redirect()->route('createMailable')->with('error', 'mailable already exists! to overide it enable force option.');
433 433
             //
434 434
             return response()->json([
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
     {
481 481
         $fqcns = [];
482 482
 
483
-        if (! file_exists(config('maileclipse.mailables_dir'))) {
483
+        if (!file_exists(config('maileclipse.mailables_dir'))) {
484 484
             return;
485 485
         } else {
486 486
             $allFiles = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(config('maileclipse.mailables_dir')));
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
                 $tokens = token_get_all($content);
494 494
                 $namespace = '';
495 495
                 for ($index = 0; isset($tokens[$index]); $index++) {
496
-                    if (! isset($tokens[$index][0])) {
496
+                    if (!isset($tokens[$index][0])) {
497 497
                         continue;
498 498
                     }
499 499
                     if (T_NAMESPACE === $tokens[$index][0]) {
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 
510 510
                         $mailableClass = $namespace.'\\'.$tokens[$index][1];
511 511
 
512
-                        if (! self::mailable_exists($mailableClass)) {
512
+                        if (!self::mailable_exists($mailableClass)) {
513 513
                             continue;
514 514
                         }
515 515
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 
522 522
                         $mailable_data = self::buildMailable($mailableClass);
523 523
 
524
-                        if (! is_null(self::handleMailableViewDataArgs($mailableClass))) {
524
+                        if (!is_null(self::handleMailableViewDataArgs($mailableClass))) {
525 525
                             $mailable_view_data = self::getMailableViewData(self::handleMailableViewDataArgs($mailableClass), $mailable_data);
526 526
                         } else {
527 527
                             $mailable_view_data = self::getMailableViewData(new $mailableClass, $mailable_data);
@@ -542,16 +542,16 @@  discard block
 block discarded – undo
542 542
                         $fqcns[$i]['view_path'] = null;
543 543
                         $fqcns[$i]['text_view_path'] = null;
544 544
 
545
-                        if (! is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) {
545
+                        if (!is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) {
546 546
                             $fqcns[$i]['view_path'] = View($fqcns[$i]['markdown'])->getPath();
547 547
                         }
548 548
 
549
-                        if (! is_null($fqcns[$i]['data'])) {
550
-                            if (! is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) {
549
+                        if (!is_null($fqcns[$i]['data'])) {
550
+                            if (!is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) {
551 551
                                 $fqcns[$i]['view_path'] = View($fqcns[$i]['data']->view)->getPath();
552 552
                             }
553 553
 
554
-                            if (! is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) {
554
+                            if (!is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) {
555 555
                                 $fqcns[$i]['text_view_path'] = View($fqcns[$i]['data']->textView)->getPath();
556 556
                                 $fqcns[$i]['text_view'] = $fqcns[$i]['data']->textView;
557 557
                             }
@@ -564,10 +564,10 @@  discard block
 block discarded – undo
564 564
                 }
565 565
             }
566 566
 
567
-            $collection = collect($fqcns)->map(function ($mailable) {
567
+            $collection = collect($fqcns)->map(function($mailable) {
568 568
                 return $mailable;
569
-            })->reject(function ($object) {
570
-                return ! method_exists($object['namespace'], 'build');
569
+            })->reject(function($object) {
570
+                return !method_exists($object['namespace'], 'build');
571 571
             });
572 572
 
573 573
             return $collection;
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 
589 589
             $eloquentFactory = app(EloquentFactory::class);
590 590
 
591
-            $args = collect($params)->map(function ($param) {
591
+            $args = collect($params)->map(function($param) {
592 592
                 if ($param->getType() !== null) {
593 593
                     if (class_exists($param->getType()->getName())) {
594 594
                         $parameters = [
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 
635 635
             $reflector = new ReflectionClass($mailable);
636 636
 
637
-            if (! $args->isEmpty()) {
637
+            if (!$args->isEmpty()) {
638 638
                 $foo = $reflector->newInstanceArgs($filteredparams);
639 639
 
640 640
                 return $foo;
@@ -666,17 +666,17 @@  discard block
 block discarded – undo
666 666
         $reflection = collect($params)->where('name', $arg)->first()->getType();
667 667
 
668 668
         if (version_compare(phpversion(), '7.1', '>=')) {
669
-            $type = ! is_null($reflection)
669
+            $type = !is_null($reflection)
670 670
                 ? self::TYPES[$reflection->getName()]
671 671
                 : null;
672 672
         } else {
673
-            $type = ! is_null($reflection)
673
+            $type = !is_null($reflection)
674 674
                 ? self::TYPES[/** @scrutinizer ignore-deprecated */ $reflection->__toString()]
675 675
                 : null;
676 676
         }
677 677
 
678 678
         try {
679
-            return ! is_null($type)
679
+            return !is_null($type)
680 680
                     ? $type
681 681
                     : new Mocked($arg, \ReeceM\Mocker\Utils\VarStore::singleton());
682 682
         } catch (\Exception $e) {
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 
702 702
         foreach ($properties as $prop) {
703 703
             if ($prop->class == $data->getName() || $prop->class == get_parent_class($data->getName()) &&
704
-                    get_parent_class($data->getName()) != 'Illuminate\Mail\Mailable' && ! $prop->isStatic()) {
704
+                    get_parent_class($data->getName()) != 'Illuminate\Mail\Mailable' && !$prop->isStatic()) {
705 705
                 $allProps[] = $prop->name;
706 706
             }
707 707
         }
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 
721 721
         $mailableData = collect($classProps)->merge($withFuncData);
722 722
 
723
-        $data = $mailableData->map(function ($parameter) use ($mailable_data) {
723
+        $data = $mailableData->map(function($parameter) use ($mailable_data) {
724 724
             return [
725 725
                 'key' => $parameter,
726 726
                 'value' => property_exists($mailable_data, $parameter) ? $mailable_data->$parameter : null,
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 
754 754
     protected static function mailable_exists($mailable)
755 755
     {
756
-        if (! class_exists($mailable)) {
756
+        if (!class_exists($mailable)) {
757 757
             return false;
758 758
         }
759 759
 
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
     public static function buildMailable($instance, $type = 'call')
779 779
     {
780 780
         if ($type == 'call') {
781
-            if (! is_null(self::handleMailableViewDataArgs($instance))) {
781
+            if (!is_null(self::handleMailableViewDataArgs($instance))) {
782 782
                 return Container::getInstance()->call([self::handleMailableViewDataArgs($instance), 'build']);
783 783
             }
784 784
 
@@ -790,17 +790,17 @@  discard block
 block discarded – undo
790 790
 
791 791
     public static function renderPreview($simpleview, $view, $template = false, $instance = null)
792 792
     {
793
-        if (! View::exists($view)) {
793
+        if (!View::exists($view)) {
794 794
             return;
795 795
         }
796 796
 
797
-        if (! $template) {
797
+        if (!$template) {
798 798
             $obj = self::buildMailable($instance);
799 799
             $viewData = $obj->viewData;
800 800
             $_data = array_merge($instance->buildViewData(), $viewData);
801 801
 
802 802
             foreach ($_data as $key => $value) {
803
-                if (! is_object($value)) {
803
+                if (!is_object($value)) {
804 804
                     $_data[$key] = '<span class="maileclipse-key" title="Variable">'.$key.'</span>';
805 805
                 }
806 806
             }
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
          */
864 864
         $name = ucwords(Str::camel(Str::slug($input, '_'))).$suffix;
865 865
 
866
-        if (! preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/', $name) ||
866
+        if (!preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/', $name) ||
867 867
             substr_compare($name, $suffix, -strlen($suffix), strlen($suffix), true) !== 0
868 868
         ) {
869 869
             return false;
Please login to merge, or discard this patch.