@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!function_exists('JavaScript')){ |
|
3 | +if (!function_exists('JavaScript')) { |
|
4 | 4 | /** |
5 | 5 | * @return \Blok\JavaScript\JavaScript |
6 | 6 | */ |
7 | - function javascript($key = null, $value = null){ |
|
7 | + function javascript($key = null, $value = null) { |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * @var $javascript \Blok\JavaScript\JavaScript |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | public function register() |
11 | 11 | { |
12 | - $this->app->singleton('JavaScript', function ($app) { |
|
12 | + $this->app->singleton('JavaScript', function($app) { |
|
13 | 13 | return new JavaScript(config('javascript.namespace')); |
14 | 14 | }); |
15 | 15 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @example |
27 | 27 | * @javascript($namespace, (optional) $array) |
28 | 28 | */ |
29 | - Blade::directive('javascript', function ($expression) { |
|
29 | + Blade::directive('javascript', function($expression) { |
|
30 | 30 | return "<?php echo JavaScript::render({$expression}); ?>"; |
31 | 31 | }); |
32 | 32 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | * @param $value |
176 | 176 | * @return JavaScript |
177 | 177 | */ |
178 | - public function add($key, $value = null){ |
|
178 | + public function add($key, $value = null) { |
|
179 | 179 | return $this->set($key, $value); |
180 | 180 | } |
181 | 181 | |
@@ -308,10 +308,10 @@ discard block |
||
308 | 308 | |
309 | 309 | $this->merge($variables); |
310 | 310 | |
311 | - return ($scriptTag?'<script>':'').'window.' . $varName . ' = ' . $this->toJson() . ';'.($scriptTag?'</script>':''); |
|
311 | + return ($scriptTag ? '<script>' : '') . 'window.' . $varName . ' = ' . $this->toJson() . ';' . ($scriptTag ? '</script>' : ''); |
|
312 | 312 | } |
313 | 313 | |
314 | - public function renderVar($namespace = null, $variables = []){ |
|
314 | + public function renderVar($namespace = null, $variables = []) { |
|
315 | 315 | return $this->render($namespace, $variables, false); |
316 | 316 | } |
317 | 317 |