@@ -38,8 +38,8 @@ discard block |
||
| 38 | 38 | $template = self::getTemplates() |
| 39 | 39 | ->where('template_slug', $templateSlug)->first(); |
| 40 | 40 | |
| 41 | - if (! is_null($template)) { |
|
| 42 | - self::saveTemplates(self::getTemplates()->reject(function ($value, $key) use ($template) { |
|
| 41 | + if (!is_null($template)) { |
|
| 42 | + self::saveTemplates(self::getTemplates()->reject(function($value, $key) use ($template) { |
|
| 43 | 43 | return $value->template_slug == $template->template_slug; |
| 44 | 44 | })); |
| 45 | 45 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | public static function getTemplatesFile() |
| 64 | 64 | { |
| 65 | 65 | $file = config('maileclipse.mailables_dir').'templates.json'; |
| 66 | - if (! file_exists($file)) { |
|
| 67 | - if (! file_exists(config('maileclipse.mailables_dir'))) { |
|
| 66 | + if (!file_exists($file)) { |
|
| 67 | + if (!file_exists(config('maileclipse.mailables_dir'))) { |
|
| 68 | 68 | mkdir(config('maileclipse.mailables_dir')); |
| 69 | 69 | } |
| 70 | 70 | file_put_contents($file, '[]'); |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | $template = self::getTemplates() |
| 84 | 84 | ->where('template_slug', $request->templateslug)->first(); |
| 85 | 85 | |
| 86 | - if (! is_null($template)) { |
|
| 87 | - if (! preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->title)) { |
|
| 86 | + if (!is_null($template)) { |
|
| 87 | + if (!preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->title)) { |
|
| 88 | 88 | return response()->json([ |
| 89 | 89 | 'status' => 'failed', |
| 90 | 90 | 'message' => 'Template name not valid', |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | // Update |
| 110 | 110 | // |
| 111 | - $oldForm = self::getTemplates()->reject(function ($value, $key) use ($template) { |
|
| 111 | + $oldForm = self::getTemplates()->reject(function($value, $key) use ($template) { |
|
| 112 | 112 | return $value->template_slug == $template->template_slug; |
| 113 | 113 | }); |
| 114 | 114 | $newForm = array_merge($oldForm->toArray(), [array_merge((array) $template, [ |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $template = self::getTemplates() |
| 150 | 150 | ->where('template_slug', $templateSlug)->first(); |
| 151 | 151 | |
| 152 | - if (! is_null($template)) { |
|
| 152 | + if (!is_null($template)) { |
|
| 153 | 153 | $template_view = self::$view_namespace.'::templates.'.$template->template_slug; |
| 154 | 154 | $template_plaintext_view = $template_view.'_plain_text'; |
| 155 | 155 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | public static function createTemplate($request) |
| 188 | 188 | { |
| 189 | - if (! preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->template_name)) { |
|
| 189 | + if (!preg_match("/^[a-zA-Z0-9-_\s]+$/", $request->template_name)) { |
|
| 190 | 190 | return response()->json([ |
| 191 | 191 | |
| 192 | 192 | 'status' => 'error', |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $templatename = camel_case(preg_replace('/\s+/', '_', $request->template_name)); |
| 201 | 201 | |
| 202 | - if (! view()->exists($view) && ! self::getTemplates()->contains('template_slug', '=', $templatename)) { |
|
| 202 | + if (!view()->exists($view) && !self::getTemplates()->contains('template_slug', '=', $templatename)) { |
|
| 203 | 203 | self::saveTemplates(self::getTemplates() |
| 204 | 204 | ->push([ |
| 205 | 205 | 'template_name' => $request->template_name, |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | $dir = resource_path('views/vendor/'.self::$view_namespace.'/templates'); |
| 214 | 214 | |
| 215 | - if (! \File::isDirectory($dir)) { |
|
| 215 | + if (!\File::isDirectory($dir)) { |
|
| 216 | 216 | \File::makeDirectory($dir, 0755, true); |
| 217 | 217 | } |
| 218 | 218 | |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | $replaced = self::templateComponentReplace($content); |
| 338 | 338 | |
| 339 | - if (! $save) { |
|
| 339 | + if (!$save) { |
|
| 340 | 340 | return $replaced; |
| 341 | 341 | } |
| 342 | 342 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | if ($template) { |
| 356 | 356 | $instance = null; |
| 357 | 357 | } else { |
| 358 | - if (! is_null(self::handleMailableViewDataArgs($namespace))) { |
|
| 358 | + if (!is_null(self::handleMailableViewDataArgs($namespace))) { |
|
| 359 | 359 | $instance = self::handleMailableViewDataArgs($namespace); |
| 360 | 360 | } else { |
| 361 | 361 | $instance = new $namespace; |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | $templateData = collect($mailable->first())->only(['markdown', 'view_path', 'text_view_path', 'text_view', 'view_data', 'data', 'namespace'])->all(); |
| 385 | 385 | |
| 386 | - $templateExists = ! is_null($templateData['view_path']); |
|
| 387 | - $textTemplateExists = ! is_null($templateData['text_view_path']); |
|
| 386 | + $templateExists = !is_null($templateData['view_path']); |
|
| 387 | + $textTemplateExists = !is_null($templateData['text_view_path']); |
|
| 388 | 388 | |
| 389 | 389 | if ($templateExists) { |
| 390 | 390 | $viewPathParams = collect($templateData)->union([ |
@@ -392,8 +392,8 @@ discard block |
||
| 392 | 392 | 'text_template' => $textTemplateExists ? file_get_contents($templateData['text_view_path']) : null, |
| 393 | 393 | 'template' => file_get_contents($templateData['view_path']), |
| 394 | 394 | 'markdowned_template' => self::markdownedTemplate($templateData['view_path']), |
| 395 | - 'template_name' => ! is_null($templateData['markdown']) ? $templateData['markdown'] : $templateData['data']->view, |
|
| 396 | - 'is_markdown' => ! is_null($templateData['markdown']) ? true : false, |
|
| 395 | + 'template_name' => !is_null($templateData['markdown']) ? $templateData['markdown'] : $templateData['data']->view, |
|
| 396 | + 'is_markdown' => !is_null($templateData['markdown']) ? true : false, |
|
| 397 | 397 | // 'text_template' => file_get_contents($templateData['text_view_path']), |
| 398 | 398 | |
| 399 | 399 | ])->all(); |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | { |
| 409 | 409 | $name = ucwords(camel_case(preg_replace('/\s+/', '_', $request->input('name')))); |
| 410 | 410 | |
| 411 | - if (! self::getMailable('name', $name)->isEmpty() && ! $request->has('force')) { |
|
| 411 | + if (!self::getMailable('name', $name)->isEmpty() && !$request->has('force')) { |
|
| 412 | 412 | // return redirect()->route('createMailable')->with('error', 'mailable already exists! to overide it enable force option.'); |
| 413 | 413 | // |
| 414 | 414 | return response()->json([ |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | { |
| 461 | 461 | $fqcns = []; |
| 462 | 462 | |
| 463 | - if (! file_exists(config('maileclipse.mailables_dir'))): |
|
| 463 | + if (!file_exists(config('maileclipse.mailables_dir'))): |
|
| 464 | 464 | |
| 465 | 465 | return; else: |
| 466 | 466 | |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | $tokens = token_get_all($content); |
| 475 | 475 | $namespace = ''; |
| 476 | 476 | for ($index = 0; isset($tokens[$index]); $index++) { |
| 477 | - if (! isset($tokens[$index][0])) { |
|
| 477 | + if (!isset($tokens[$index][0])) { |
|
| 478 | 478 | continue; |
| 479 | 479 | } |
| 480 | 480 | if (T_NAMESPACE === $tokens[$index][0]) { |
@@ -490,13 +490,13 @@ discard block |
||
| 490 | 490 | |
| 491 | 491 | $mailableClass = $namespace.'\\'.$tokens[$index][1]; |
| 492 | 492 | |
| 493 | - if (! self::mailable_exists($mailableClass)) { |
|
| 493 | + if (!self::mailable_exists($mailableClass)) { |
|
| 494 | 494 | continue; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | $mailable_data = self::buildMailable($mailableClass); |
| 498 | 498 | |
| 499 | - if (! is_null(self::handleMailableViewDataArgs($mailableClass))) { |
|
| 499 | + if (!is_null(self::handleMailableViewDataArgs($mailableClass))) { |
|
| 500 | 500 | $mailable_view_data = self::getMailableViewData(self::handleMailableViewDataArgs($mailableClass), $mailable_data); |
| 501 | 501 | } else { |
| 502 | 502 | $mailable_view_data = self::getMailableViewData(new $mailableClass, $mailable_data); |
@@ -517,16 +517,16 @@ discard block |
||
| 517 | 517 | $fqcns[$i]['view_path'] = null; |
| 518 | 518 | $fqcns[$i]['text_view_path'] = null; |
| 519 | 519 | |
| 520 | - if (! is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) { |
|
| 520 | + if (!is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) { |
|
| 521 | 521 | $fqcns[$i]['view_path'] = View($fqcns[$i]['markdown'])->getPath(); |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - if (! is_null($fqcns[$i]['data'])) { |
|
| 525 | - if (! is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) { |
|
| 524 | + if (!is_null($fqcns[$i]['data'])) { |
|
| 525 | + if (!is_null($fqcns[$i]['data']->view) && View::exists($fqcns[$i]['data']->view)) { |
|
| 526 | 526 | $fqcns[$i]['view_path'] = View($fqcns[$i]['data']->view)->getPath(); |
| 527 | 527 | } |
| 528 | 528 | |
| 529 | - if (! is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) { |
|
| 529 | + if (!is_null($fqcns[$i]['data']->textView) && View::exists($fqcns[$i]['data']->textView)) { |
|
| 530 | 530 | $fqcns[$i]['text_view_path'] = View($fqcns[$i]['data']->textView)->getPath(); |
| 531 | 531 | $fqcns[$i]['text_view'] = $fqcns[$i]['data']->textView; |
| 532 | 532 | } |
@@ -539,10 +539,10 @@ discard block |
||
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | - $collection = collect($fqcns)->map(function ($mailable) { |
|
| 542 | + $collection = collect($fqcns)->map(function($mailable) { |
|
| 543 | 543 | return $mailable; |
| 544 | - })->reject(function ($object) { |
|
| 545 | - return ! method_exists($object['namespace'], 'build'); |
|
| 544 | + })->reject(function($object) { |
|
| 545 | + return !method_exists($object['namespace'], 'build'); |
|
| 546 | 546 | }); |
| 547 | 547 | |
| 548 | 548 | // return $collection->all(); |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | $eloquentFactory = app(EloquentFactory::class); |
| 570 | 570 | |
| 571 | - $args = collect($params)->map(function ($param) { |
|
| 571 | + $args = collect($params)->map(function($param) { |
|
| 572 | 572 | if ($param->getType() !== null) { |
| 573 | 573 | if (class_exists($param->getType()->getName())) { |
| 574 | 574 | $parameters = [ |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | |
| 619 | 619 | $reflector = new ReflectionClass($mailable); |
| 620 | 620 | |
| 621 | - if (! $args->isEmpty()) { |
|
| 621 | + if (!$args->isEmpty()) { |
|
| 622 | 622 | $foo = $reflector->newInstanceArgs($filteredparams); |
| 623 | 623 | |
| 624 | 624 | return $foo; |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | |
| 664 | 664 | $mailableData = collect($classProps)->merge($withFuncData); |
| 665 | 665 | |
| 666 | - $data = $mailableData->map(function ($parameter) use ($mailable_data) { |
|
| 666 | + $data = $mailableData->map(function($parameter) use ($mailable_data) { |
|
| 667 | 667 | return [ |
| 668 | 668 | 'key' => $parameter, |
| 669 | 669 | 'value' => property_exists($mailable_data, $parameter) ? $mailable_data->$parameter : null, |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | |
| 697 | 697 | protected static function mailable_exists($mailable) |
| 698 | 698 | { |
| 699 | - if (! class_exists($mailable)) { |
|
| 699 | + if (!class_exists($mailable)) { |
|
| 700 | 700 | return false; |
| 701 | 701 | } |
| 702 | 702 | |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | public static function buildMailable($instance, $type = 'call') |
| 722 | 722 | { |
| 723 | 723 | if ($type == 'call') { |
| 724 | - if (! is_null(self::handleMailableViewDataArgs($instance))) { |
|
| 724 | + if (!is_null(self::handleMailableViewDataArgs($instance))) { |
|
| 725 | 725 | return Container::getInstance()->call([self::handleMailableViewDataArgs($instance), 'build']); |
| 726 | 726 | } |
| 727 | 727 | |
@@ -733,17 +733,17 @@ discard block |
||
| 733 | 733 | |
| 734 | 734 | public static function renderPreview($simpleview, $view, $template = false, $instance = null) |
| 735 | 735 | { |
| 736 | - if (! View::exists($view)) { |
|
| 736 | + if (!View::exists($view)) { |
|
| 737 | 737 | return; |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | - if (! $template) { |
|
| 740 | + if (!$template) { |
|
| 741 | 741 | $obj = self::buildMailable($instance); |
| 742 | 742 | $viewData = $obj->viewData; |
| 743 | 743 | $_data = array_merge($instance->buildViewData(), $viewData); |
| 744 | 744 | |
| 745 | 745 | foreach ($_data as $key => $value) { |
| 746 | - if (! is_object($value)) { |
|
| 746 | + if (!is_object($value)) { |
|
| 747 | 747 | $_data[$key] = '<span class="maileclipse-key" title="Variable">'.$key.'</span>'; |
| 748 | 748 | } |
| 749 | 749 | } |
@@ -462,9 +462,11 @@ |
||
| 462 | 462 | |
| 463 | 463 | if (! file_exists(config('maileclipse.mailables_dir'))): |
| 464 | 464 | |
| 465 | - return; else: |
|
| 465 | + return; else { |
|
| 466 | + : |
|
| 466 | 467 | |
| 467 | 468 | $allFiles = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(config('maileclipse.mailables_dir'))); |
| 469 | + } |
|
| 468 | 470 | $phpFiles = new RegexIterator($allFiles, '/\.php$/'); |
| 469 | 471 | $i = 0; |
| 470 | 472 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | { |
| 59 | 59 | $templateData = mailEclipse::getMailableTemplateData($name); |
| 60 | 60 | |
| 61 | - if (! $templateData) { |
|
| 61 | + if (!$templateData) { |
|
| 62 | 62 | return redirect()->route('viewMailable', ['name' => $name]); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $resource = $mailable->first(); |
| 107 | 107 | |
| 108 | - if (! is_null(mailEclipse::handleMailableViewDataArgs($resource['namespace']))) { |
|
| 108 | + if (!is_null(mailEclipse::handleMailableViewDataArgs($resource['namespace']))) { |
|
| 109 | 109 | // $instance = new $resource['namespace']; |
| 110 | 110 | // |
| 111 | 111 | $instance = mailEclipse::handleMailableViewDataArgs($resource['namespace']); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | return 'View not found'; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $view = ! is_null($resource['markdown']) ? $resource['markdown'] : $resource['data']->view; |
|
| 120 | + $view = !is_null($resource['markdown']) ? $resource['markdown'] : $resource['data']->view; |
|
| 121 | 121 | |
| 122 | 122 | if (view()->exists($view)) { |
| 123 | 123 | try { |
@@ -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'); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | private function registerRoutes() |
| 35 | 35 | { |
| 36 | - Route::group($this->routeConfiguration(), function () { |
|
| 36 | + Route::group($this->routeConfiguration(), function() { |
|
| 37 | 37 | $this->loadRoutesFrom(__DIR__.'/Http/routes.php'); |
| 38 | 38 | }); |
| 39 | 39 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $this->mergeConfigFrom(__DIR__.'/../config/maileclipse.php', 'maileclipse'); |
| 63 | 63 | |
| 64 | 64 | // Register the service the package provides. |
| 65 | - $this->app->singleton('maileclipse', function ($app) { |
|
| 65 | + $this->app->singleton('maileclipse', function($app) { |
|
| 66 | 66 | return new mailEclipse; |
| 67 | 67 | }); |
| 68 | 68 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | | |
| 71 | 71 | */ |
| 72 | 72 | |
| 73 | - 'skeletons' => [ |
|
| 73 | + 'skeletons' => [ |
|
| 74 | 74 | |
| 75 | 75 | 'html' => [ |
| 76 | 76 | |
@@ -244,6 +244,6 @@ discard block |
||
| 244 | 244 | 'welcome', |
| 245 | 245 | ], |
| 246 | 246 | ], |
| 247 | - ], |
|
| 247 | + ], |
|
| 248 | 248 | |
| 249 | 249 | ]; |