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