@@ -2,7 +2,7 @@ discard block |
||
| 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 |
||
| 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'); |
@@ -34,7 +34,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -59,7 +59,7 @@ |
||
| 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 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | ->where('template_slug', $templateSlug)->first(); |
| 72 | 72 | |
| 73 | 73 | if ($template !== null) { |
| 74 | - self::saveTemplates(self::getTemplates()->reject(function ($value) use ($template) { |
|
| 74 | + self::saveTemplates(self::getTemplates()->reject(function($value) use ($template) { |
|
| 75 | 75 | return $value->template_slug === $template->template_slug; |
| 76 | 76 | })); |
| 77 | 77 | |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | public static function getTemplatesFile() |
| 100 | 100 | { |
| 101 | 101 | $file = config('maileclipse.mailables_dir').'templates.json'; |
| 102 | - if (! file_exists($file)) { |
|
| 103 | - if (! file_exists(config('maileclipse.mailables_dir'))) { |
|
| 102 | + if (!file_exists($file)) { |
|
| 103 | + if (!file_exists(config('maileclipse.mailables_dir'))) { |
|
| 104 | 104 | if (!mkdir($concurrentDirectory = config('maileclipse.mailables_dir')) && !is_dir($concurrentDirectory)) { |
| 105 | 105 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory)); |
| 106 | 106 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | ->where('template_slug', $request->templateslug)->first(); |
| 132 | 132 | |
| 133 | 133 | if ($template !== null) { |
| 134 | - if (! preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->title)) { |
|
| 134 | + if (!preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->title)) { |
|
| 135 | 135 | return response()->json([ |
| 136 | 136 | 'status' => 'failed', |
| 137 | 137 | 'message' => 'Template name not valid', |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // Update |
| 153 | - $oldForm = self::getTemplates()->reject(function ($value) use ($template) { |
|
| 153 | + $oldForm = self::getTemplates()->reject(function($value) use ($template) { |
|
| 154 | 154 | return $value->template_slug === $template->template_slug; |
| 155 | 155 | }); |
| 156 | 156 | $newForm = array_merge($oldForm->toArray(), [array_merge((array) $template, [ |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public static function createTemplate($request): JsonResponse |
| 235 | 235 | { |
| 236 | - if (! preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->template_name)) { |
|
| 236 | + if (!preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->template_name)) { |
|
| 237 | 237 | return response()->json([ |
| 238 | 238 | 'status' => 'error', |
| 239 | 239 | 'message' => 'Template name not valid', |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | $view = self::$view_namespace.'::templates.'.$request->template_name; |
| 245 | 245 | $templateName = Str::camel(preg_replace('/\s+/', '_', $request->template_name)); |
| 246 | 246 | |
| 247 | - if (! view()->exists($view) && ! self::getTemplates()->contains('template_slug', '=', $templateName)) { |
|
| 247 | + if (!view()->exists($view) && !self::getTemplates()->contains('template_slug', '=', $templateName)) { |
|
| 248 | 248 | self::saveTemplates(self::getTemplates() |
| 249 | 249 | ->push([ |
| 250 | 250 | 'template_name' => $request->template_name, |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | $dir = resource_path('views/vendor/'.self::$view_namespace.'/templates'); |
| 259 | 259 | |
| 260 | - if (! File::isDirectory($dir)) { |
|
| 260 | + if (!File::isDirectory($dir)) { |
|
| 261 | 261 | File::makeDirectory($dir, 0755, true); |
| 262 | 262 | } |
| 263 | 263 | |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | |
| 397 | 397 | $replaced = self::templateComponentReplace($content); |
| 398 | 398 | |
| 399 | - if (! $save) { |
|
| 399 | + if (!$save) { |
|
| 400 | 400 | return $replaced; |
| 401 | 401 | } |
| 402 | 402 | |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | ]); |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - if (! $request->has('force') && ! self::getMailable('name', $name)->isEmpty()) { |
|
| 496 | + if (!$request->has('force') && !self::getMailable('name', $name)->isEmpty()) { |
|
| 497 | 497 | return response()->json([ |
| 498 | 498 | 'status' => 'error', |
| 499 | 499 | 'message' => 'This mailable name already exists. names should be unique! to override it, enable "force" option.', |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | { |
| 547 | 547 | $fqcns = []; |
| 548 | 548 | |
| 549 | - if (! file_exists(config('maileclipse.mailables_dir'))) { |
|
| 549 | + if (!file_exists(config('maileclipse.mailables_dir'))) { |
|
| 550 | 550 | return; |
| 551 | 551 | } else { |
| 552 | 552 | $allFiles = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(config('maileclipse.mailables_dir'))); |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | $tokens = token_get_all($content); |
| 560 | 560 | $namespace = ''; |
| 561 | 561 | for ($index = 0; isset($tokens[$index]); $index++) { |
| 562 | - if (! isset($tokens[$index][0])) { |
|
| 562 | + if (!isset($tokens[$index][0])) { |
|
| 563 | 563 | continue; |
| 564 | 564 | } |
| 565 | 565 | if (T_NAMESPACE === $tokens[$index][0]) { |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | |
| 576 | 576 | $mailableClass = $namespace.'\\'.$tokens[$index][1]; |
| 577 | 577 | |
| 578 | - if (! self::mailable_exists($mailableClass)) { |
|
| 578 | + if (!self::mailable_exists($mailableClass)) { |
|
| 579 | 579 | continue; |
| 580 | 580 | } |
| 581 | 581 | |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | |
| 588 | 588 | $mailable_data = self::buildMailable($mailableClass); |
| 589 | 589 | |
| 590 | - if (! is_null(self::handleMailableViewDataArgs($mailableClass))) { |
|
| 590 | + if (!is_null(self::handleMailableViewDataArgs($mailableClass))) { |
|
| 591 | 591 | $mailable_view_data = self::getMailableViewData(self::handleMailableViewDataArgs($mailableClass), $mailable_data); |
| 592 | 592 | } else { |
| 593 | 593 | $mailable_view_data = self::getMailableViewData(new $mailableClass, $mailable_data); |
@@ -608,16 +608,16 @@ discard block |
||
| 608 | 608 | $fqcns[$i]['view_path'] = null; |
| 609 | 609 | $fqcns[$i]['text_view_path'] = null; |
| 610 | 610 | |
| 611 | - if (! is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) { |
|
| 611 | + if (!is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) { |
|
| 612 | 612 | $fqcns[$i]['view_path'] = View($fqcns[$i]['markdown'])->getPath(); |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - if (! is_null($fqcns[$i]['data'])) { |
|
| 616 | - if (! is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) { |
|
| 615 | + if (!is_null($fqcns[$i]['data'])) { |
|
| 616 | + if (!is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) { |
|
| 617 | 617 | $fqcns[$i]['view_path'] = View($fqcns[$i]['data']->view)->getPath(); |
| 618 | 618 | } |
| 619 | 619 | |
| 620 | - if (! is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) { |
|
| 620 | + if (!is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) { |
|
| 621 | 621 | $fqcns[$i]['text_view_path'] = View($fqcns[$i]['data']->textView)->getPath(); |
| 622 | 622 | $fqcns[$i]['text_view'] = $fqcns[$i]['data']->textView; |
| 623 | 623 | } |
@@ -630,10 +630,10 @@ discard block |
||
| 630 | 630 | } |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | - $collection = collect($fqcns)->map(function ($mailable) { |
|
| 633 | + $collection = collect($fqcns)->map(function($mailable) { |
|
| 634 | 634 | return $mailable; |
| 635 | - })->reject(function ($object) { |
|
| 636 | - return ! method_exists($object['namespace'], 'build'); |
|
| 635 | + })->reject(function($object) { |
|
| 636 | + return !method_exists($object['namespace'], 'build'); |
|
| 637 | 637 | }); |
| 638 | 638 | |
| 639 | 639 | return $collection; |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | |
| 658 | 658 | $eloquentFactory = app(EloquentFactory::class); |
| 659 | 659 | |
| 660 | - $args = collect($params)->map(function ($param) { |
|
| 660 | + $args = collect($params)->map(function($param) { |
|
| 661 | 661 | if ($param->getType() !== null) { |
| 662 | 662 | if (class_exists($param->getType()->getName())) { |
| 663 | 663 | $parameters = [ |
@@ -729,17 +729,17 @@ discard block |
||
| 729 | 729 | $reflection = collect($params)->where('name', $arg)->first()->getType(); |
| 730 | 730 | |
| 731 | 731 | if (version_compare(phpversion(), '7.1', '>=')) { |
| 732 | - $type = ! is_null($reflection) |
|
| 732 | + $type = !is_null($reflection) |
|
| 733 | 733 | ? self::TYPES[$reflection->getName()] |
| 734 | 734 | : null; |
| 735 | 735 | } else { |
| 736 | - $type = ! is_null($reflection) |
|
| 736 | + $type = !is_null($reflection) |
|
| 737 | 737 | ? self::TYPES[/** @scrutinizer ignore-deprecated */ $reflection->__toString()] |
| 738 | 738 | : null; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | try { |
| 742 | - return ! is_null($type) |
|
| 742 | + return !is_null($type) |
|
| 743 | 743 | ? $type |
| 744 | 744 | : new Mocked($arg, \ReeceM\Mocker\Utils\VarStore::singleton()); |
| 745 | 745 | } catch (\Exception $e) { |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | |
| 771 | 771 | foreach ($properties as $prop) { |
| 772 | 772 | if ($prop->class == $data->getName() || $prop->class == get_parent_class($data->getName()) && |
| 773 | - get_parent_class($data->getName()) != 'Illuminate\Mail\Mailable' && ! $prop->isStatic()) { |
|
| 773 | + get_parent_class($data->getName()) != 'Illuminate\Mail\Mailable' && !$prop->isStatic()) { |
|
| 774 | 774 | $allProps[] = $prop->name; |
| 775 | 775 | } |
| 776 | 776 | } |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | |
| 790 | 790 | $mailableData = collect($classProps)->merge($withFuncData); |
| 791 | 791 | |
| 792 | - $data = $mailableData->map(function ($parameter) use ($mailable_data) { |
|
| 792 | + $data = $mailableData->map(function($parameter) use ($mailable_data) { |
|
| 793 | 793 | return [ |
| 794 | 794 | 'key' => $parameter, |
| 795 | 795 | 'value' => property_exists($mailable_data, $parameter) ? $mailable_data->$parameter : null, |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | */ |
| 831 | 831 | protected static function mailable_exists($mailable): bool |
| 832 | 832 | { |
| 833 | - if (! class_exists($mailable)) { |
|
| 833 | + if (!class_exists($mailable)) { |
|
| 834 | 834 | return false; |
| 835 | 835 | } |
| 836 | 836 | |
@@ -889,17 +889,17 @@ discard block |
||
| 889 | 889 | */ |
| 890 | 890 | public static function renderPreview($simpleview, $view, $template = false, $instance = null) |
| 891 | 891 | { |
| 892 | - if (! View::exists($view)) { |
|
| 892 | + if (!View::exists($view)) { |
|
| 893 | 893 | return; |
| 894 | 894 | } |
| 895 | 895 | |
| 896 | - if (! $template) { |
|
| 896 | + if (!$template) { |
|
| 897 | 897 | $obj = self::buildMailable($instance); |
| 898 | 898 | $viewData = $obj->viewData; |
| 899 | 899 | $_data = array_merge($instance->buildViewData(), $viewData); |
| 900 | 900 | |
| 901 | 901 | foreach ($_data as $key => $value) { |
| 902 | - if (! is_object($value)) { |
|
| 902 | + if (!is_object($value)) { |
|
| 903 | 903 | $_data[$key] = '<span class="maileclipse-key" title="Variable">'.$key.'</span>'; |
| 904 | 904 | } |
| 905 | 905 | } |
@@ -962,7 +962,7 @@ discard block |
||
| 962 | 962 | */ |
| 963 | 963 | $name = ucwords(Str::camel(Str::slug($input, '_'))).$suffix; |
| 964 | 964 | |
| 965 | - if (! preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/', $name) || |
|
| 965 | + if (!preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/', $name) || |
|
| 966 | 966 | substr_compare($name, $suffix, -strlen($suffix), strlen($suffix), true) !== 0 |
| 967 | 967 | ) { |
| 968 | 968 | return false; |