@@ -51,8 +51,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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(); |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | { |
| 422 | 422 | $name = ucwords(Str::camel(preg_replace('/\s+/', '_', $request->input('name')))); |
| 423 | 423 | |
| 424 | - if (! self::getMailable('name', $name)->isEmpty() && ! $request->has('force')) { |
|
| 424 | + if (!self::getMailable('name', $name)->isEmpty() && !$request->has('force')) { |
|
| 425 | 425 | // return redirect()->route('createMailable')->with('error', 'mailable already exists! to overide it enable force option.'); |
| 426 | 426 | // |
| 427 | 427 | return response()->json([ |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | { |
| 474 | 474 | $fqcns = []; |
| 475 | 475 | |
| 476 | - if (! file_exists(config('maileclipse.mailables_dir'))): |
|
| 476 | + if (!file_exists(config('maileclipse.mailables_dir'))): |
|
| 477 | 477 | |
| 478 | 478 | return; else: |
| 479 | 479 | |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | $tokens = token_get_all($content); |
| 488 | 488 | $namespace = ''; |
| 489 | 489 | for ($index = 0; isset($tokens[$index]); $index++) { |
| 490 | - if (! isset($tokens[$index][0])) { |
|
| 490 | + if (!isset($tokens[$index][0])) { |
|
| 491 | 491 | continue; |
| 492 | 492 | } |
| 493 | 493 | if (T_NAMESPACE === $tokens[$index][0]) { |
@@ -503,13 +503,13 @@ discard block |
||
| 503 | 503 | |
| 504 | 504 | $mailableClass = $namespace.'\\'.$tokens[$index][1]; |
| 505 | 505 | |
| 506 | - if (! self::mailable_exists($mailableClass)) { |
|
| 506 | + if (!self::mailable_exists($mailableClass)) { |
|
| 507 | 507 | continue; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | $mailable_data = self::buildMailable($mailableClass); |
| 511 | 511 | |
| 512 | - if (! is_null(self::handleMailableViewDataArgs($mailableClass))) { |
|
| 512 | + if (!is_null(self::handleMailableViewDataArgs($mailableClass))) { |
|
| 513 | 513 | $mailable_view_data = self::getMailableViewData(self::handleMailableViewDataArgs($mailableClass), $mailable_data); |
| 514 | 514 | } else { |
| 515 | 515 | $mailable_view_data = self::getMailableViewData(new $mailableClass, $mailable_data); |
@@ -530,16 +530,16 @@ discard block |
||
| 530 | 530 | $fqcns[$i]['view_path'] = null; |
| 531 | 531 | $fqcns[$i]['text_view_path'] = null; |
| 532 | 532 | |
| 533 | - if (! is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) { |
|
| 533 | + if (!is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) { |
|
| 534 | 534 | $fqcns[$i]['view_path'] = View($fqcns[$i]['markdown'])->getPath(); |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - if (! is_null($fqcns[$i]['data'])) { |
|
| 538 | - if (! is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) { |
|
| 537 | + if (!is_null($fqcns[$i]['data'])) { |
|
| 538 | + if (!is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) { |
|
| 539 | 539 | $fqcns[$i]['view_path'] = View($fqcns[$i]['data']->view)->getPath(); |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - if (! is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) { |
|
| 542 | + if (!is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) { |
|
| 543 | 543 | $fqcns[$i]['text_view_path'] = View($fqcns[$i]['data']->textView)->getPath(); |
| 544 | 544 | $fqcns[$i]['text_view'] = $fqcns[$i]['data']->textView; |
| 545 | 545 | } |
@@ -552,10 +552,10 @@ discard block |
||
| 552 | 552 | } |
| 553 | 553 | } |
| 554 | 554 | |
| 555 | - $collection = collect($fqcns)->map(function ($mailable) { |
|
| 555 | + $collection = collect($fqcns)->map(function($mailable) { |
|
| 556 | 556 | return $mailable; |
| 557 | - })->reject(function ($object) { |
|
| 558 | - return ! method_exists($object['namespace'], 'build'); |
|
| 557 | + })->reject(function($object) { |
|
| 558 | + return !method_exists($object['namespace'], 'build'); |
|
| 559 | 559 | }); |
| 560 | 560 | |
| 561 | 561 | // return $collection->all(); |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | |
| 580 | 580 | $eloquentFactory = app(EloquentFactory::class); |
| 581 | 581 | |
| 582 | - $args = collect($params)->map(function ($param) { |
|
| 582 | + $args = collect($params)->map(function($param) { |
|
| 583 | 583 | if ($param->getType() !== null) { |
| 584 | 584 | if (class_exists($param->getType()->getName())) { |
| 585 | 585 | $parameters = [ |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | |
| 626 | 626 | $reflector = new ReflectionClass($mailable); |
| 627 | 627 | |
| 628 | - if (! $args->isEmpty()) { |
|
| 628 | + if (!$args->isEmpty()) { |
|
| 629 | 629 | $foo = $reflector->newInstanceArgs($filteredparams); |
| 630 | 630 | |
| 631 | 631 | return $foo; |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | $argType = self::TYPES[$argType] ?? null; |
| 657 | 657 | |
| 658 | 658 | try { |
| 659 | - return ! is_null($argType) |
|
| 659 | + return !is_null($argType) |
|
| 660 | 660 | ? $argType |
| 661 | 661 | : new Mocked($arg, \ReeceM\Mocker\Utils\VarStore::singleton()); |
| 662 | 662 | } catch (\Exception $e) { |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | |
| 700 | 700 | $mailableData = collect($classProps)->merge($withFuncData); |
| 701 | 701 | |
| 702 | - $data = $mailableData->map(function ($parameter) use ($mailable_data) { |
|
| 702 | + $data = $mailableData->map(function($parameter) use ($mailable_data) { |
|
| 703 | 703 | return [ |
| 704 | 704 | 'key' => $parameter, |
| 705 | 705 | 'value' => property_exists($mailable_data, $parameter) ? $mailable_data->$parameter : null, |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | |
| 733 | 733 | protected static function mailable_exists($mailable) |
| 734 | 734 | { |
| 735 | - if (! class_exists($mailable)) { |
|
| 735 | + if (!class_exists($mailable)) { |
|
| 736 | 736 | return false; |
| 737 | 737 | } |
| 738 | 738 | |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | public static function buildMailable($instance, $type = 'call') |
| 758 | 758 | { |
| 759 | 759 | if ($type == 'call') { |
| 760 | - if (! is_null(self::handleMailableViewDataArgs($instance))) { |
|
| 760 | + if (!is_null(self::handleMailableViewDataArgs($instance))) { |
|
| 761 | 761 | return Container::getInstance()->call([self::handleMailableViewDataArgs($instance), 'build']); |
| 762 | 762 | } |
| 763 | 763 | |
@@ -769,17 +769,17 @@ discard block |
||
| 769 | 769 | |
| 770 | 770 | public static function renderPreview($simpleview, $view, $template = false, $instance = null) |
| 771 | 771 | { |
| 772 | - if (! View::exists($view)) { |
|
| 772 | + if (!View::exists($view)) { |
|
| 773 | 773 | return; |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | - if (! $template) { |
|
| 776 | + if (!$template) { |
|
| 777 | 777 | $obj = self::buildMailable($instance); |
| 778 | 778 | $viewData = $obj->viewData; |
| 779 | 779 | $_data = array_merge($instance->buildViewData(), $viewData); |
| 780 | 780 | |
| 781 | 781 | foreach ($_data as $key => $value) { |
| 782 | - if (! is_object($value)) { |
|
| 782 | + if (!is_object($value)) { |
|
| 783 | 783 | $_data[$key] = '<span class="maileclipse-key" title="Variable">'.$key.'</span>'; |
| 784 | 784 | } |
| 785 | 785 | } |