@@ -205,16 +205,16 @@ |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | |
| 208 | - /** |
|
| 209 | - * Add a notification. |
|
| 210 | - * |
|
| 211 | - * @param string $type Could be error, info, success, or warning. |
|
| 212 | - * @param string $message The notification's message |
|
| 213 | - * @param string $title The notification's title |
|
| 214 | - * @param bool $enableCustomButton |
|
| 215 | - * |
|
| 216 | - * @return NavToastr |
|
| 217 | - */ |
|
| 208 | + /** |
|
| 209 | + * Add a notification. |
|
| 210 | + * |
|
| 211 | + * @param string $type Could be error, info, success, or warning. |
|
| 212 | + * @param string $message The notification's message |
|
| 213 | + * @param string $title The notification's title |
|
| 214 | + * @param bool $enableCustomButton |
|
| 215 | + * |
|
| 216 | + * @return NavToastr |
|
| 217 | + */ |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | public function addNotification(string $type, string $message, bool $enableCustomButton = false): self |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | public function notifications(): array |
| 113 | 113 | { |
| 114 | 114 | return array_map( |
| 115 | - function ($n) { |
|
| 115 | + function($n) { |
|
| 116 | 116 | return $this->toast($n['type'], $n['message'], $n['enableCustomButton']); |
| 117 | 117 | }, |
| 118 | 118 | $this->session->get(self::NAVTOASTR_NOTI, []) |
@@ -243,8 +243,8 @@ discard block |
||
| 243 | 243 | { |
| 244 | 244 | |
| 245 | 245 | $option = array_map( |
| 246 | - function ($n) { |
|
| 247 | - if(array_key_exists('reload', $n) && $n['reload'] == true) |
|
| 246 | + function($n) { |
|
| 247 | + if (array_key_exists('reload', $n) && $n['reload'] == true) |
|
| 248 | 248 | return array( |
| 249 | 249 | 'text' => $n['text'], |
| 250 | 250 | 'onClick' => 'function(){window.location.reload();}' |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | $search = ['"text"', '"onClick"', '\"', '\/\/', '\/', '\"', '}"', '"f']; |
| 263 | 263 | |
| 264 | - $replace = ['text', 'onClick', '"', '//', '/', '"', '}', 'f']; |
|
| 264 | + $replace = ['text', 'onClick', '"', '//', '/', '"', '}', 'f']; |
|
| 265 | 265 | |
| 266 | 266 | |
| 267 | 267 | return 'customButtons : '.str_replace($search, $replace, $subject).''; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | */ |
| 291 | 291 | |
| 292 | 292 | |
| 293 | - public function to( string $url ) |
|
| 293 | + public function to(string $url) |
|
| 294 | 294 | { |
| 295 | 295 | return redirect($url); |
| 296 | 296 | } |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | |
| 307 | 307 | |
| 308 | - public function named( string $name ) |
|
| 308 | + public function named(string $name) |
|
| 309 | 309 | { |
| 310 | 310 | |
| 311 | 311 | return redirect()->route($name); |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | */ |
| 323 | 323 | |
| 324 | 324 | |
| 325 | - public function out( string $url ) |
|
| 325 | + public function out(string $url) |
|
| 326 | 326 | { |
| 327 | 327 | |
| 328 | 328 | return redirect()->away($url); |
@@ -244,11 +244,12 @@ |
||
| 244 | 244 | |
| 245 | 245 | $option = array_map( |
| 246 | 246 | function ($n) { |
| 247 | - if(array_key_exists('reload', $n) && $n['reload'] == true) |
|
| 248 | - return array( |
|
| 247 | + if(array_key_exists('reload', $n) && $n['reload'] == true) { |
|
| 248 | + return array( |
|
| 249 | 249 | 'text' => $n['text'], |
| 250 | 250 | 'onClick' => 'function(){window.location.reload();}' |
| 251 | 251 | ); |
| 252 | + } |
|
| 252 | 253 | return array( |
| 253 | 254 | 'text' => $n['text'], |
| 254 | 255 | 'onClick' => 'function(){window.open("'.$n['url'].'");}' |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | return; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if ($this->option('type') == 'basic' || $this->option('type') != 'none' || ! $this->option('type')) { |
|
| 74 | + if ($this->option('type') == 'basic' || $this->option('type') != 'none' || !$this->option('type')) { |
|
| 75 | 75 | $this->exportConfig(); |
| 76 | 76 | $this->exportAssets(); |
| 77 | 77 | } |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | protected function exportConfig() |
| 87 | 87 | { |
| 88 | 88 | if ($this->option('interactive')) { |
| 89 | - if (! $this->confirm('Install the package config file?')) { |
|
| 89 | + if (!$this->confirm('Install the package config file?')) { |
|
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | - if (file_exists(config_path('nav-toastr.php')) && ! $this->option('force')) { |
|
| 94 | - if (! $this->confirm('The Laravel NavToastr configuration file already exists. Do you want to replace it?')) { |
|
| 93 | + if (file_exists(config_path('nav-toastr.php')) && !$this->option('force')) { |
|
| 94 | + if (!$this->confirm('The Laravel NavToastr configuration file already exists. Do you want to replace it?')) { |
|
| 95 | 95 | return; |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | protected function exportAssets() |
| 111 | 111 | { |
| 112 | 112 | if ($this->option('interactive')) { |
| 113 | - if (! $this->confirm('Install the basic package assets?')) { |
|
| 113 | + if (!$this->confirm('Install the basic package assets?')) { |
|
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | protected function copyAssets($asset_name, $force = false) |
| 128 | 128 | { |
| 129 | - if (! isset($this->assets[$asset_name])) { |
|
| 129 | + if (!isset($this->assets[$asset_name])) { |
|
| 130 | 130 | return; |
| 131 | 131 | } |
| 132 | 132 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public static function ensureDirectoryExists($dir, $mode = 0755, $recursive = true) |
| 19 | 19 | { |
| 20 | - if (! is_dir($dir)) { |
|
| 20 | + if (!is_dir($dir)) { |
|
| 21 | 21 | mkdir($dir, $mode, $recursive); |
| 22 | 22 | } |
| 23 | 23 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | // Open the source folder. Return if fails to open. |
| 38 | 38 | |
| 39 | - if (! is_resource($dirHandler = @opendir($dir))) { |
|
| 39 | + if (!is_resource($dirHandler = @opendir($dir))) { |
|
| 40 | 40 | return; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | if (is_dir($source) && $recursive) { |
| 66 | 66 | self::copyDirectory($source, $target, $force, $recursive, $ignores); |
| 67 | - } elseif (is_file($source) && ($force || ! file_exists($target))) { |
|
| 67 | + } elseif (is_file($source) && ($force || !file_exists($target))) { |
|
| 68 | 68 | copy($source, $target); |
| 69 | 69 | } |
| 70 | 70 | } |
@@ -87,13 +87,13 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | // Open the first folder. Return if fails to open. |
| 89 | 89 | |
| 90 | - if (! is_resource($dirHandler = @opendir($dir1))) { |
|
| 90 | + if (!is_resource($dirHandler = @opendir($dir1))) { |
|
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Check if the second folder exists. |
| 95 | 95 | |
| 96 | - if (! is_dir($dir2)) { |
|
| 96 | + if (!is_dir($dir2)) { |
|
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | // If the resources to compare are files, check that both files are |
| 118 | 118 | // equals. |
| 119 | 119 | |
| 120 | - if (is_file($source) && ! self::compareFiles($source, $target)) { |
|
| 120 | + if (is_file($source) && !self::compareFiles($source, $target)) { |
|
| 121 | 121 | return false; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $isDir = is_dir($source) && $recursive; |
| 128 | 128 | |
| 129 | - if ($isDir && ! (bool) self::compareDirectories($source, $target, $recursive, $ignores)) { |
|
| 129 | + if ($isDir && !(bool) self::compareDirectories($source, $target, $recursive, $ignores)) { |
|
| 130 | 130 | return false; |
| 131 | 131 | } |
| 132 | 132 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public static function compareFiles($file1, $file2) |
| 151 | 151 | { |
| 152 | - if (! is_file($file1) || ! is_file($file2)) { |
|
| 152 | + if (!is_file($file1) || !is_file($file2)) { |
|
| 153 | 153 | return false; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -178,8 +178,7 @@ discard block |
||
| 178 | 178 | { |
| 179 | 179 | foreach ($ignores as $pattern) { |
| 180 | 180 | $match = Str::startsWith($pattern, 'regex:') ? |
| 181 | - preg_match(Str::substr($pattern, 6), $file) : |
|
| 182 | - Str::is($pattern, $file); |
|
| 181 | + preg_match(Str::substr($pattern, 6), $file) : Str::is($pattern, $file); |
|
| 183 | 182 | |
| 184 | 183 | if ($match) { |
| 185 | 184 | return true; |
@@ -58,9 +58,9 @@ |
||
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | - * Get the services provided by the provider |
|
| 62 | - * @return array |
|
| 63 | - */ |
|
| 61 | + * Get the services provided by the provider |
|
| 62 | + * @return array |
|
| 63 | + */ |
|
| 64 | 64 | |
| 65 | 65 | public function provides() |
| 66 | 66 | { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function register() |
| 33 | 33 | { |
| 34 | 34 | // |
| 35 | - $this->app->bind('nav-toastr', function (Container $app) { |
|
| 35 | + $this->app->bind('nav-toastr', function(Container $app) { |
|
| 36 | 36 | |
| 37 | 37 | return new NavToastr($app['session'], $app['config']); |
| 38 | 38 | |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | public function registerBladeDirectives() |
| 80 | 80 | { |
| 81 | - Blade::directive('navtoastrRender', function () { |
|
| 81 | + Blade::directive('navtoastrRender', function() { |
|
| 82 | 82 | return "<?php echo app('nav-toastr')->show(); ?>"; |
| 83 | 83 | }); |
| 84 | 84 | |
| 85 | - Blade::directive('navtoastrCss', function () { |
|
| 85 | + Blade::directive('navtoastrCss', function() { |
|
| 86 | 86 | return "<?php echo toastr_css(); ?>"; |
| 87 | 87 | }); |
| 88 | 88 | |
| 89 | - Blade::directive('navtoastrJs', function () { |
|
| 89 | + Blade::directive('navtoastrJs', function() { |
|
| 90 | 90 | return "<?php echo toastr_js(); ?>"; |
| 91 | 91 | }); |
| 92 | 92 | |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -if (! function_exists("navtoastr")) |
|
| 4 | +if (!function_exists("navtoastr")) |
|
| 5 | 5 | { |
| 6 | 6 | function navtoastr(string $message = null, string $type = 'success', bool $enableCustomButton = false) { |
| 7 | 7 | |
@@ -16,9 +16,9 @@ discard block |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | |
| 19 | -if(! function_exists("toastr_css") ){ |
|
| 19 | +if (!function_exists("toastr_css")) { |
|
| 20 | 20 | |
| 21 | - function toastr_css(){ |
|
| 21 | + function toastr_css() { |
|
| 22 | 22 | |
| 23 | 23 | return '<link rel="stylesheet" type="text/css" href="'.asset('vendor/nav-toastr/assets/css/app.css').'">'; |
| 24 | 24 | |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | |
| 30 | -if(! function_exists("toastr_js") ){ |
|
| 30 | +if (!function_exists("toastr_js")) { |
|
| 31 | 31 | |
| 32 | - function toastr_js(){ |
|
| 32 | + function toastr_js() { |
|
| 33 | 33 | |
| 34 | 34 | return '<script type="text/javascript" src="'.asset('vendor/nav-toastr/assets/js/app.js').'"></script>'; |
| 35 | 35 | |