diff --git a/src/Concerns/IsActive.php b/src/Concerns/IsActive.php index da2f740..b15e46a 100644 --- a/src/Concerns/IsActive.php +++ b/src/Concerns/IsActive.php @@ -3,35 +3,52 @@ namespace Jdw5\Vanguard\Concerns; /** - * Trait IsActive - * * Set an active property on a class - * - * @property bool $active */ trait IsActive { + /** Defaults to being false */ protected bool $active = false; /** - * Set the active property + * Set the active property, chainable. * * @param bool $active * @return static */ public function active(bool $active = true): static { - $this->active = $active; + $this->setActive($active); return $this; } /** - * Check if the class is active + * Set the active property quietly. + * + * @param bool $active + */ + protected function setActive(bool $active): void + { + $this->active = $active; + } + + /** + * Check if the class is active (alias) * * @return bool */ public function isActive(): bool { - return $this->active; + return $this->getActive(); + } + + /** + * Check if the class is active + * + * @return bool + */ + public function getActive(): bool + { + return $this->evaluate($this->active); } } \ No newline at end of file diff --git a/src/Concerns/IsDefault.php b/src/Concerns/IsDefault.php index a700c15..a8e188d 100644 --- a/src/Concerns/IsDefault.php +++ b/src/Concerns/IsDefault.php @@ -3,33 +3,50 @@ namespace Jdw5\Vanguard\Concerns; /** - * Trait IsDefault - * * Set whether a class is the default - * - * @property bool $default */ trait IsDefault { + /** Always default to false */ protected $default = false; /** - * Set the class as default + * Set the class as default, chainable * * @return static */ - public function default(): static + public function default(bool $default = true): static { - $this->default = true; + $this->setDefault($default); return $this; } /** - * Check if the class is default + * Set the default quietly + * + * @param bool $default + */ + protected function setDefault(bool $default): void + { + $this->default = $default; + } + + /** + * Get if the class is default (alias) * * @return bool */ public function isDefault(): bool + { + return $this->getDefault(); + } + + /** + * Get if the class is default + * + * @return bool + */ + public function getDefault(): bool { return $this->evaluate($this->default); } diff --git a/src/Concerns/IsHideable.php b/src/Concerns/IsHideable.php index f61034e..4f7697f 100644 --- a/src/Concerns/IsHideable.php +++ b/src/Concerns/IsHideable.php @@ -6,8 +6,11 @@ trait IsHideable { + /** Whether this column shown be shown */ protected bool $show = true; + /** Whether this column should only be displayed for screen readers */ protected bool $sr_only = false; + /** The breakpoint it should display at */ protected ?Breakpoint $breakpoint = null; /** @@ -22,7 +25,7 @@ public function hide(): static } /** - * Set the visibility of the column to hidden + * Set the visibility of the column to hidden (alias) * * @return static */ diff --git a/src/Table/Columns/Concerns/HasFallback.php b/src/Table/Columns/Concerns/HasFallback.php index 41208d8..7dd1128 100644 --- a/src/Table/Columns/Concerns/HasFallback.php +++ b/src/Table/Columns/Concerns/HasFallback.php @@ -7,7 +7,7 @@ */ trait HasFallback { - protected mixed $fallback; + protected mixed $fallback = null; /** * Set the fallback value, chainable. @@ -40,7 +40,7 @@ protected function setFallback(mixed $fallback): void */ public function hasFallback(): bool { - return isset($this->fallback); + return \is_null($this->getFallback()); } /**