File: D:/HostingSpaces/carrotps/carrotps.com/app/Komma/Kms/Core/Attributes/Password.php
<?php
namespace App\Komma\Kms\Core\Attributes;
use App\Komma\Kms\Core\Attributes\Traits\LabelTrait;
use App\Komma\Kms\Core\Attributes\Traits\PlaceholderTextTrait;
use App\Komma\Kms\Core\Attributes\Traits\ReadOnlyTrait;
use Mockery\Generator\StringManipulation\Pass\Pass;
class Password extends Attribute
{
use PlaceholderTextTrait;
use ReadOnlyTrait;
/**
* @var string $labelText
*/
private $labelText = '';
/**
* @var string $repeatLabelText
*/
private $repeatLabelText = '';
/** @var string */
private $mailButtonText = '';
/** @var int */
private $userId = 0;
/**
* Password constructor.
* @param string $password The text of the title
*/
public function __construct(string $password = '')
{
parent::__construct();
$this->setValue($password);
}
/**
* Returns true if the password is an empty string.
* Notice: When the password is an empty string, the result of getValue is not an empty string!
* That is why this method is needed.
*/
public function isEmpty()
{
return !$this->value || $this->value == '';
}
/**
* @return string The hashed password.
*/
public function getValue(): string
{
return \Hash::make($this->value);
}
/**
* Returns a view that visually represents this attribute
*
* @return \Illuminate\View\View
*/
public function render()
{
return view('kms/attributes.password', [
'attribute' => $this
]);
}
/**
* @return string
*/
public function getLabelText()
{
return $this->labelText;
}
/**
* @param string $labelText
* @return $this
*/
public function setLabelText(string $labelText): Password
{
$this->labelText = $labelText;
return $this;
}
/**
* @return string
*/
public function getRepeatLabelText()
{
return $this->repeatLabelText;
}
/**
* @param string $repeatLabelText
* @return $this
*/
public function setRepeatLabelText(string $repeatLabelText): Password
{
$this->repeatLabelText = $repeatLabelText;
return $this;
}
/**
* @return string
*/
public function getMailButtonText(): string
{
return $this->mailButtonText;
}
/**
* @param string $mailButtonText
* @return $this
*/
public function setMailButtonText(string $mailButtonText): Password
{
$this->mailButtonText = $mailButtonText;
return $this;
}
/**
* @return int|null
*/
public function getUserId()
{
return $this->userId;
}
/**
* @param int|null $userId
* @return Password
*/
public function setUserId($userId): Password
{
$this->userId = $userId;
return $this;
}
}