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