@@ -34,10 +34,10 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | final public function displayModuleContent($method, $args) { |
| 36 | 36 | // if method not callbale abort to 'not found' |
| 37 | - if (! is_callable([$this, $method])) abort(404); |
|
| 37 | + if (!is_callable([$this, $method])) abort(404); |
|
| 38 | 38 | |
| 39 | 39 | // if user has no access abort 'no access' |
| 40 | - if (! $this->access()) abort(401); |
|
| 40 | + if (!$this->access()) abort(401); |
|
| 41 | 41 | |
| 42 | 42 | $args = $this->decodeArgs($args); |
| 43 | 43 | |
@@ -34,10 +34,14 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | final public function displayModuleContent($method, $args) { |
| 36 | 36 | // if method not callbale abort to 'not found' |
| 37 | - if (! is_callable([$this, $method])) abort(404); |
|
| 37 | + if (! is_callable([$this, $method])) { |
|
| 38 | + abort(404); |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | 41 | // if user has no access abort 'no access' |
| 40 | - if (! $this->access()) abort(401); |
|
| 42 | + if (! $this->access()) { |
|
| 43 | + abort(401); |
|
| 44 | + } |
|
| 41 | 45 | |
| 42 | 46 | $args = $this->decodeArgs($args); |
| 43 | 47 | |
@@ -46,7 +46,9 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $templatesDir = static::path() . DIRECTORY_SEPARATOR . 'Templates'; |
| 48 | 48 | |
| 49 | - if (! is_dir($templatesDir)) return; |
|
| 49 | + if (! is_dir($templatesDir)) { |
|
| 50 | + return; |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | 53 | $skinDir = $templatesDir . DIRECTORY_SEPARATOR . $skin; |
| 52 | 54 | |
@@ -62,11 +62,11 @@ |
||
| 62 | 62 | { |
| 63 | 63 | $templatesDir = static::path() . DIRECTORY_SEPARATOR . 'Templates'; |
| 64 | 64 | |
| 65 | - if (! is_dir($templatesDir)) return; |
|
| 65 | + if (!is_dir($templatesDir)) return; |
|
| 66 | 66 | |
| 67 | 67 | $skinDir = $templatesDir . DIRECTORY_SEPARATOR . $skin; |
| 68 | 68 | |
| 69 | - return is_dir($skinDir)? $skinDir: $templatesDir; |
|
| 69 | + return is_dir($skinDir) ? $skinDir : $templatesDir; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | public static function translations() |
@@ -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(), |