@@ -36,13 +36,13 @@ |
||
36 | 36 | return $this; |
37 | 37 | } |
38 | 38 | |
39 | - $this->label = is_array($this->label)? $this->label: [$this->label]; |
|
39 | + $this->label = is_array($this->label) ? $this->label : [$this->label]; |
|
40 | 40 | |
41 | 41 | $this->label = array_map('trans', $this->label); |
42 | 42 | |
43 | - $this->location = is_array($this->location)? $this->location: [$this->location]; |
|
43 | + $this->location = is_array($this->location) ? $this->location : [$this->location]; |
|
44 | 44 | |
45 | - return array_merge($this->label, $this->location?: []); |
|
45 | + return array_merge($this->label, $this->location ?: []); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function label($label) |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $defaultView = self::module()::view(); |
21 | 21 | |
22 | - $viewClass = is_a(static::class, ModuleView::class, true)? static::class: $defaultView; |
|
22 | + $viewClass = is_a(static::class, ModuleView::class, true) ? static::class : $defaultView; |
|
23 | 23 | |
24 | 24 | if ($viewClass == $defaultView) $viewClass = null; |
25 | 25 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | final public static function moduleLink($module, $method = 'body', $args = []) |
40 | 40 | { |
41 | - $alias = class_exists($module)? $module::alias(): $module; |
|
41 | + $alias = class_exists($module) ? $module::alias() : $module; |
|
42 | 42 | |
43 | 43 | return url(implode('/', ['view', $alias, $method, self::encodeArgs($args)])); |
44 | 44 | } |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | * @throws \Illuminate\Http\Exceptions\HttpResponseException |
53 | 53 | */ |
54 | 54 | final public static function decodeArgs($hash) { |
55 | - if (! $hash) return []; |
|
55 | + if (!$hash) return []; |
|
56 | 56 | |
57 | 57 | $args = session($hash); |
58 | 58 | |
59 | 59 | if (is_null($args)) abort(419); |
60 | 60 | |
61 | - return is_array($args)? $args: [$args]; |
|
61 | + return is_array($args) ? $args : [$args]; |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | * @return string |
69 | 69 | */ |
70 | 70 | final public static function encodeArgs($args) { |
71 | - $args = is_array($args)? $args: [$args]; |
|
71 | + $args = is_array($args) ? $args : [$args]; |
|
72 | 72 | |
73 | - if (! $args) return; |
|
73 | + if (!$args) return; |
|
74 | 74 | |
75 | 75 | $hash = md5(serialize($args)); |
76 | 76 |
@@ -21,7 +21,9 @@ discard block |
||
21 | 21 | |
22 | 22 | $viewClass = is_a(static::class, ModuleView::class, true)? static::class: $defaultView; |
23 | 23 | |
24 | - if ($viewClass == $defaultView) $viewClass = null; |
|
24 | + if ($viewClass == $defaultView) { |
|
25 | + $viewClass = null; |
|
26 | + } |
|
25 | 27 | |
26 | 28 | return url(implode('/', ['view', implode('_', array_filter([self::alias(), $viewClass])), $method, self::encodeArgs($args)])); |
27 | 29 | } |
@@ -52,11 +54,15 @@ discard block |
||
52 | 54 | * @throws \Illuminate\Http\Exceptions\HttpResponseException |
53 | 55 | */ |
54 | 56 | final public static function decodeArgs($hash) { |
55 | - if (! $hash) return []; |
|
57 | + if (! $hash) { |
|
58 | + return []; |
|
59 | + } |
|
56 | 60 | |
57 | 61 | $args = session($hash); |
58 | 62 | |
59 | - if (is_null($args)) abort(419); |
|
63 | + if (is_null($args)) { |
|
64 | + abort(419); |
|
65 | + } |
|
60 | 66 | |
61 | 67 | return is_array($args)? $args: [$args]; |
62 | 68 | } |
@@ -70,7 +76,9 @@ discard block |
||
70 | 76 | final public static function encodeArgs($args) { |
71 | 77 | $args = is_array($args)? $args: [$args]; |
72 | 78 | |
73 | - if (! $args) return; |
|
79 | + if (! $args) { |
|
80 | + return; |
|
81 | + } |
|
74 | 82 | |
75 | 83 | $hash = md5(serialize($args)); |
76 | 84 |
@@ -6,16 +6,16 @@ |
||
6 | 6 | { |
7 | 7 | public function notify($options, $attachTo = null) |
8 | 8 | { |
9 | - $options = array_merge(['duration'=> 1500], is_array($options)? $options: ['content' => $options]); |
|
9 | + $options = array_merge(['duration'=> 1500], is_array($options) ? $options : ['content' => $options]); |
|
10 | 10 | |
11 | - $attachTo = $attachTo?: $this; |
|
11 | + $attachTo = $attachTo ?: $this; |
|
12 | 12 | |
13 | 13 | return (new \atk4\ui\jsNotify($options, $attachTo)); |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function notifyError($options, $attachTo = null) |
17 | 17 | { |
18 | - $options = array_merge(['color' => 'red'], is_array($options)? $options: ['content' => $options]); |
|
18 | + $options = array_merge(['color' => 'red'], is_array($options) ? $options : ['content' => $options]); |
|
19 | 19 | |
20 | 20 | return $this->notify($options, $attachTo); |
21 | 21 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | |
12 | 12 | final public static function packageManifest() |
13 | 13 | { |
14 | - return self::$packageManifest = self::$packageManifest?: new PackageManifest(new Filesystem(), app()->basePath(), self::getCachedManifestPath()); |
|
14 | + return self::$packageManifest = self::$packageManifest ?: new PackageManifest(new Filesystem(), app()->basePath(), self::getCachedManifestPath()); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | final public static function getCachedManifestPath() |
@@ -12,11 +12,11 @@ |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | final public static function requireJS($file = 'default.js', $isAsync = false, $isDefer = false) { |
15 | - return epesi()->requireJS(self::assetUrl('js/'. $file), $isAsync, $isDefer); |
|
15 | + return epesi()->requireJS(self::assetUrl('js/' . $file), $isAsync, $isDefer); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | final public static function requireCSS($file = 'default.css') { |
19 | - return epesi()->requireCSS(self::assetUrl('css/'. $file)); |
|
19 | + return epesi()->requireCSS(self::assetUrl('css/' . $file)); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -14,11 +14,11 @@ discard block |
||
14 | 14 | */ |
15 | 15 | final public static function view($alias = null) |
16 | 16 | { |
17 | - $class = self::namespace() . '\\' . ($alias? Str::studly($alias): self::name()) . 'View'; |
|
17 | + $class = self::namespace() . '\\' . ($alias ? Str::studly($alias) : self::name()) . 'View'; |
|
18 | 18 | |
19 | 19 | if ($alias) return $class; |
20 | 20 | |
21 | - return static::$view?: $class; |
|
21 | + return static::$view ?: $class; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $names = array_slice(explode('\\', static::class), -2, -1); |
66 | 66 | |
67 | - return $names? reset($names): ''; |
|
67 | + return $names ? reset($names) : ''; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -16,7 +16,9 @@ |
||
16 | 16 | { |
17 | 17 | $class = self::namespace() . '\\' . ($alias? Str::studly($alias): self::name()) . 'View'; |
18 | 18 | |
19 | - if ($alias) return $class; |
|
19 | + if ($alias) { |
|
20 | + return $class; |
|
21 | + } |
|
20 | 22 | |
21 | 23 | return static::$view?: $class; |
22 | 24 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | { |
34 | 34 | $link = $this->link(); |
35 | 35 | |
36 | - $link = is_array($link)? ModuleView::moduleLink(...$link): $link; |
|
36 | + $link = is_array($link) ? ModuleView::moduleLink(...$link) : $link; |
|
37 | 37 | |
38 | 38 | return (new LaunchButton([ |
39 | 39 | 'label' => $this->label(), |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | private static $variables; |
18 | 18 | |
19 | 19 | private static function cache() { |
20 | - if(isset(self::$variables)) return; |
|
20 | + if (isset(self::$variables)) return; |
|
21 | 21 | |
22 | 22 | self::$variables = self::pluck('value', 'name'); |
23 | 23 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | public static function get($name, $throwError = true) { |
26 | 26 | self::cache(); |
27 | 27 | |
28 | - if (! self::$variables->has($name) && $throwError) { |
|
28 | + if (!self::$variables->has($name) && $throwError) { |
|
29 | 29 | throw new \Exception('No such variable in database: ' . $name); |
30 | 30 | } |
31 | 31 | |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | return self::updateOrCreate(compact('name'), compact('value')); |
47 | 47 | } |
48 | 48 | |
49 | - public static function forget($name, $throwError=true) { |
|
49 | + public static function forget($name, $throwError = true) { |
|
50 | 50 | self::cache(); |
51 | 51 | |
52 | - if (! self::$variables->has($name) && $throwError) { |
|
52 | + if (!self::$variables->has($name) && $throwError) { |
|
53 | 53 | throw new \Exception('No such variable in database: ' . $name); |
54 | 54 | } |
55 | 55 |
@@ -17,7 +17,9 @@ |
||
17 | 17 | private static $variables; |
18 | 18 | |
19 | 19 | private static function cache() { |
20 | - if(isset(self::$variables)) return; |
|
20 | + if(isset(self::$variables)) { |
|
21 | + return; |
|
22 | + } |
|
21 | 23 | |
22 | 24 | self::$variables = self::pluck('value', 'name'); |
23 | 25 | } |
@@ -7,49 +7,49 @@ |
||
7 | 7 | |
8 | 8 | class ActionButton extends View |
9 | 9 | { |
10 | - public $defaultTemplate = 'action_button.html'; |
|
10 | + public $defaultTemplate = 'action_button.html'; |
|
11 | 11 | |
12 | - public $ui = 'basic inverted action button'; |
|
12 | + public $ui = 'basic inverted action button'; |
|
13 | 13 | |
14 | - /** |
|
15 | - * Icon that will appear on the button (top). |
|
16 | - * |
|
17 | - * @var string|array|Icon |
|
18 | - */ |
|
19 | - public $icon; |
|
14 | + /** |
|
15 | + * Icon that will appear on the button (top). |
|
16 | + * |
|
17 | + * @var string|array|Icon |
|
18 | + */ |
|
19 | + public $icon; |
|
20 | 20 | |
21 | - public $label; |
|
21 | + public $label; |
|
22 | 22 | |
23 | - public $element = 'a'; |
|
23 | + public $element = 'a'; |
|
24 | 24 | |
25 | - public $weight = 10; |
|
25 | + public $weight = 10; |
|
26 | 26 | |
27 | - public function renderView() |
|
28 | - { |
|
29 | - $this->addIcon(); |
|
27 | + public function renderView() |
|
28 | + { |
|
29 | + $this->addIcon(); |
|
30 | 30 | |
31 | - $this->addLabel(); |
|
31 | + $this->addLabel(); |
|
32 | 32 | |
33 | - parent::renderView(); |
|
34 | - } |
|
33 | + parent::renderView(); |
|
34 | + } |
|
35 | 35 | |
36 | - protected function addIcon() |
|
37 | - { |
|
38 | - if (! $icon = $this->getIcon()) return; |
|
36 | + protected function addIcon() |
|
37 | + { |
|
38 | + if (! $icon = $this->getIcon()) return; |
|
39 | 39 | |
40 | - $this->add($icon, 'Icon')->id = null; |
|
40 | + $this->add($icon, 'Icon')->id = null; |
|
41 | 41 | |
42 | - $this->addClass('icon'); |
|
43 | - } |
|
42 | + $this->addClass('icon'); |
|
43 | + } |
|
44 | 44 | |
45 | - protected function addLabel() |
|
46 | - { |
|
47 | - $this->content = $this->label?: $this->content; |
|
48 | - } |
|
49 | - |
|
50 | - public function getIcon() |
|
51 | - { |
|
52 | - return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
53 | - } |
|
45 | + protected function addLabel() |
|
46 | + { |
|
47 | + $this->content = $this->label?: $this->content; |
|
48 | + } |
|
49 | + |
|
50 | + public function getIcon() |
|
51 | + { |
|
52 | + return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function addIcon() |
37 | 37 | { |
38 | - if (! $icon = $this->getIcon()) return; |
|
38 | + if (!$icon = $this->getIcon()) return; |
|
39 | 39 | |
40 | 40 | $this->add($icon, 'Icon')->id = null; |
41 | 41 | |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | |
45 | 45 | protected function addLabel() |
46 | 46 | { |
47 | - $this->content = $this->label?: $this->content; |
|
47 | + $this->content = $this->label ?: $this->content; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | public function getIcon() |
51 | 51 | { |
52 | - return is_object($this->icon)? $this->icon: new Icon($this->icon); |
|
52 | + return is_object($this->icon) ? $this->icon : new Icon($this->icon); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | } |
@@ -35,7 +35,9 @@ |
||
35 | 35 | |
36 | 36 | protected function addIcon() |
37 | 37 | { |
38 | - if (! $icon = $this->getIcon()) return; |
|
38 | + if (! $icon = $this->getIcon()) { |
|
39 | + return; |
|
40 | + } |
|
39 | 41 | |
40 | 42 | $this->add($icon, 'Icon')->id = null; |
41 | 43 |