update composer, client and account

Signed-off-by: envoyr <hello@envoyr.com>
This commit is contained in:
2024-12-21 17:04:56 +01:00
parent fcb8417eae
commit 65fd44e74a
5 changed files with 253 additions and 154 deletions

View File

@@ -359,7 +359,7 @@ class Client
$data = json_decode((string)$response->getBody(), true);
$accountURL = $response->getHeaderLine('Location');
$date = (new \DateTime())->setTimestamp(strtotime($data['createdAt']));
return new Account($data['contact'], $date, ($data['status'] == 'valid'), $data['initialIp'], $accountURL);
return new Account($data['contact'], $date, ($data['status'] == 'valid'), $accountURL);
}
/**
@@ -535,9 +535,9 @@ class Client
$userDirectory = preg_replace('/[^a-z0-9]+/', '-', strtolower($this->getOption('username')));
return $this->getOption(
'basePath',
'le'
) . DIRECTORY_SEPARATOR . $userDirectory . ($path === null ? '' : DIRECTORY_SEPARATOR . $path);
'basePath',
'le'
) . DIRECTORY_SEPARATOR . $userDirectory . ($path === null ? '' : DIRECTORY_SEPARATOR . $path);
}
/**
@@ -753,4 +753,4 @@ class Client
'signature' => Helper::toSafeString($signature),
];
}
}
}

View File

@@ -20,11 +20,6 @@ class Account
*/
protected $isValid;
/**
* @var
*/
protected $initialIp;
/**
* @var string
*/
@@ -36,17 +31,14 @@ class Account
* @param array $contact
* @param \DateTime $createdAt
* @param bool $isValid
* @param string $initialIp
* @param string $accountURL
*/
public function __construct(
array $contact,
\DateTime $createdAt,
bool $isValid,
string $initialIp,
string $accountURL
) {
$this->initialIp = $initialIp;
$this->contact = $contact;
$this->createdAt = $createdAt;
$this->isValid = $isValid;
@@ -89,15 +81,6 @@ class Account
return $this->contact;
}
/**
* Return initial IP
* @return string
*/
public function getInitialIp(): string
{
return $this->initialIp;
}
/**
* Returns validation status
* @return bool
@@ -106,4 +89,4 @@ class Account
{
return $this->isValid;
}
}
}