67 lines
1.2 KiB
PHP
67 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Utils\Traits;
|
|
|
|
use App\Utils\Credential;
|
|
|
|
trait Auth
|
|
{
|
|
private $credential;
|
|
private $usernameArg;
|
|
private $passwordArg;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->usernameArg = "--user=";
|
|
$this->passwordArg = "--password=";
|
|
}
|
|
|
|
/**
|
|
* @param Credential $credential
|
|
*/
|
|
public function setCredential(Credential $credential): void
|
|
{
|
|
$this->credential = $credential;
|
|
}
|
|
|
|
/**
|
|
* @return Credential
|
|
*/
|
|
public function getCredential(): Credential
|
|
{
|
|
return $this->credential;
|
|
}
|
|
|
|
/**
|
|
* @param string $usernameArg
|
|
*/
|
|
public function setUsernameArg(string $usernameArg = "--user="): void
|
|
{
|
|
$this->usernameArg = $usernameArg;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getUsernameArg(): string
|
|
{
|
|
return $this->usernameArg;
|
|
}
|
|
|
|
/**
|
|
* @param string $passwordArg
|
|
*/
|
|
public function setPasswordArg(string $passwordArg = "--password="): void
|
|
{
|
|
$this->passwordArg = $passwordArg;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getPasswordArg(): string
|
|
{
|
|
return $this->passwordArg;
|
|
}
|
|
}
|