File: D:/HostingSpaces/SBogers10/wingssprayer.komma.pro/vendor/komma/kms/src/Core/Attributes/OnOff.php
<?php
namespace Komma\KMS\Core\Attributes;
use Komma\KMS\Core\Attributes\Traits\ExplanationTrait;
use Komma\KMS\Core\Attributes\Traits\LabelTrait;
class OnOff extends Attribute
{
use LabelTrait;
use ExplanationTrait;
/**
* OnOff constructor.
*/
public function __construct()
{
parent::__construct();
$this->value = "0";
}
/**
* Turns the object on
*/
public function switchOn() {
$this->value = "1";
return $this;
}
/**
* Turns the object off
*/
public function switchOff() {
$this->value = "0";
return $this;
}
/**
* If the object is on it switches it off and vice versa
*
* @return $this
*/
public function toggle() {
$this->value = !$this->value;
return $this;
}
/**
* Returns true if the object is switched on
*/
public function isOn() {
return $this->value === "1";
}
/**
* Returns true if the object is switched off
*/
public function isOff() {
return $this->value === "0";
}
/**
* Returns a view that visually represents this attribute
*/
public function render()
{
return view('KMS::kms/attributes.onOff', [
'attribute' => $this
]);
}
}