. */ namespace SP\Services\Crypt; use SP\Core\Crypt\Hash; use SP\Services\Task\Task; /** * Class UpdateMasterPassRequest * * @package SP\Services\Crypt */ final class UpdateMasterPassRequest { /** * @var string */ private $currentMasterPass; /** * @var string */ private $newMasterPass; /** * @var Task */ private $task; /** * @var string */ private $hash; /** * @var string */ private $currentHash; /** * UpdateMasterPassRequest constructor. * * @param string $currentMasterPass * @param string $newMasterPass * @param string $currentHash * @param Task $task */ public function __construct($currentMasterPass, $newMasterPass, $currentHash, Task $task = null) { $this->currentMasterPass = $currentMasterPass; $this->newMasterPass = $newMasterPass; $this->task = $task; $this->hash = Hash::hashKey($newMasterPass); $this->currentHash = $currentHash; } /** * @return string */ public function getCurrentMasterPass() { return $this->currentMasterPass; } /** * @return string */ public function getNewMasterPass() { return $this->newMasterPass; } /** * @return Task */ public function getTask() { return $this->task; } /** * @return bool */ public function useTask() { return $this->task !== null; } /** * @return string */ public function getHash() { return $this->hash; } /** * @return string */ public function getCurrentHash() { return $this->currentHash; } }