@@ -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 | |
@@ -52,8 +52,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 = [ |
@@ -665,17 +665,17 @@ discard block |
||
| 665 | 665 | $reflection = collect($params)->where('name', $arg)->first()->getType(); |
| 666 | 666 | |
| 667 | 667 | if (version_compare(phpversion(), '7.1', '>=')) { |
| 668 | - $type = ! is_null($reflection) |
|
| 668 | + $type = !is_null($reflection) |
|
| 669 | 669 | ? self::TYPES[$reflection->getName()] |
| 670 | 670 | : null; |
| 671 | 671 | } else { |
| 672 | - $type = ! is_null($reflection) |
|
| 672 | + $type = !is_null($reflection) |
|
| 673 | 673 | ? self::TYPES[/** @scrutinizer ignore-deprecated */ $reflection->__toString()] |
| 674 | 674 | : null; |
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | try { |
| 678 | - return ! is_null($type) |
|
| 678 | + return !is_null($type) |
|
| 679 | 679 | ? $type |
| 680 | 680 | : new Mocked($arg, \ReeceM\Mocker\Utils\VarStore::singleton()); |
| 681 | 681 | } catch (\Exception $e) { |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | |
| 701 | 701 | foreach ($properties as $prop) { |
| 702 | 702 | if ($prop->class == $data->getName() || $prop->class == get_parent_class($data->getName()) && |
| 703 | - get_parent_class($data->getName()) != 'Illuminate\Mail\Mailable' && ! $prop->isStatic()) { |
|
| 703 | + get_parent_class($data->getName()) != 'Illuminate\Mail\Mailable' && !$prop->isStatic()) { |
|
| 704 | 704 | $allProps[] = $prop->name; |
| 705 | 705 | } |
| 706 | 706 | } |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | |
| 720 | 720 | $mailableData = collect($classProps)->merge($withFuncData); |
| 721 | 721 | |
| 722 | - $data = $mailableData->map(function ($parameter) use ($mailable_data) { |
|
| 722 | + $data = $mailableData->map(function($parameter) use ($mailable_data) { |
|
| 723 | 723 | return [ |
| 724 | 724 | 'key' => $parameter, |
| 725 | 725 | 'value' => property_exists($mailable_data, $parameter) ? $mailable_data->$parameter : null, |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | |
| 753 | 753 | protected static function mailable_exists($mailable) |
| 754 | 754 | { |
| 755 | - if (! class_exists($mailable)) { |
|
| 755 | + if (!class_exists($mailable)) { |
|
| 756 | 756 | return false; |
| 757 | 757 | } |
| 758 | 758 | |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | public static function buildMailable($instance, $type = 'call') |
| 778 | 778 | { |
| 779 | 779 | if ($type == 'call') { |
| 780 | - if (! is_null(self::handleMailableViewDataArgs($instance))) { |
|
| 780 | + if (!is_null(self::handleMailableViewDataArgs($instance))) { |
|
| 781 | 781 | return Container::getInstance()->call([self::handleMailableViewDataArgs($instance), 'build']); |
| 782 | 782 | } |
| 783 | 783 | |
@@ -789,17 +789,17 @@ discard block |
||
| 789 | 789 | |
| 790 | 790 | public static function renderPreview($simpleview, $view, $template = false, $instance = null) |
| 791 | 791 | { |
| 792 | - if (! View::exists($view)) { |
|
| 792 | + if (!View::exists($view)) { |
|
| 793 | 793 | return; |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | - if (! $template) { |
|
| 796 | + if (!$template) { |
|
| 797 | 797 | $obj = self::buildMailable($instance); |
| 798 | 798 | $viewData = $obj->viewData; |
| 799 | 799 | $_data = array_merge($instance->buildViewData(), $viewData); |
| 800 | 800 | |
| 801 | 801 | foreach ($_data as $key => $value) { |
| 802 | - if (! is_object($value)) { |
|
| 802 | + if (!is_object($value)) { |
|
| 803 | 803 | $_data[$key] = '<span class="maileclipse-key" title="Variable">'.$key.'</span>'; |
| 804 | 804 | } |
| 805 | 805 | } |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | */ |
| 863 | 863 | $name = ucwords(Str::camel(Str::slug($input, '_'))).$suffix; |
| 864 | 864 | |
| 865 | - if (! preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/', $name) || |
|
| 865 | + if (!preg_match('/^[a-zA-Z_\x80-\xff][a-zA-Z0-9_\x80-\xff]*$/', $name) || |
|
| 866 | 866 | substr_compare($name, $suffix, -strlen($suffix), strlen($suffix), true) !== 0 |
| 867 | 867 | ) { |
| 868 | 868 | return false; |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | return ($mailableInstance)->render(); |
| 919 | 919 | } |
| 920 | 920 | |
| 921 | - return view(self::$view_namespace . '::previewerror', ['errorMessage' => 'No template associated with this mailable.']); |
|
| 921 | + return view(self::$view_namespace.'::previewerror', ['errorMessage' => 'No template associated with this mailable.']); |
|
| 922 | 922 | } |
| 923 | 923 | |
| 924 | 924 | |