Skip to content

Commit

Permalink
Merge pull request #51 from mtrop-godaddy/mt-support_php_81
Browse files Browse the repository at this point in the history
Support for PHP 8.1+
  • Loading branch information
pgibson1-godaddy authored Sep 4, 2024
2 parents f118a0f + 8e71de9 commit c4d90f4
Show file tree
Hide file tree
Showing 39 changed files with 805 additions and 684 deletions.
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
}
},
"require": {
"php": "^7.1",
"php": "^8.1",
"rdlowrey/auryn": "^1.4",
"duncan3dc/console": "^2.0",
"guzzlehttp/guzzle": "^6.3",
"vlucas/phpdotenv": "^2.4",
"duncan3dc/console": "^2.3",
"symfony/console": "^5.3.16 || ^6.0.19",
"guzzlehttp/guzzle": "^7.8",
"vlucas/phpdotenv": "^5.0",
"monolog/monolog": "^1.21",
"namshi/cuzzle": "^2.0",
"octoper/cuzzle": "^3.0",
"ramsey/uuid": "^3.5"
}
}
1,393 changes: 757 additions & 636 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/API/BaseApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BaseApiClient

protected $apiName;

public function __construct(RequestChain $requestChain, $baseUrl = 'https://mgmt.pagely.com/api/', LoggerInterface $logger)
public function __construct(RequestChain $requestChain, LoggerInterface $logger, string $baseUrl = 'https://mgmt.pagely.com/api/')
{
$this->requestChain = $requestChain;
$this->baseUrl = $baseUrl;
Expand Down
6 changes: 3 additions & 3 deletions src/Client/GuzzleTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function(callable $handler) use ($logger)
$msg = 'API Request: ' .$request->getMethod(). ' ' .$request->getUri();
$logger->debug($msg, [
'api' => $this->apiName,
'request' => \GuzzleHttp\Psr7\str($request),
'request' => \GuzzleHttp\Psr7\Message::toString($request),
'uri' => $request->getUri(),
'method' => $request->getMethod()
]);
Expand All @@ -154,8 +154,8 @@ function (ResponseInterface $response) use ($logger, $request)
if ($response->getStatusCode() >= 400) {
$context = [
'api' => $this->apiName,
'response' => \GuzzleHttp\Psr7\str($response),
'request' => \GuzzleHttp\Psr7\str($request),
'response' => \GuzzleHttp\Psr7\Message::toString($response),
'request' => \GuzzleHttp\Psr7\Message::toString($request),
'code' => $response->getStatusCode(),
'uri' => $request->getUri(),
'method' => $request->getMethod()
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Accounts/AddSshKeyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$accountId = (int) $input->getArgument('accountId');
$token = $this->token->token;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Apps/AliasSearchCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$accountId = $input->getArgument('accountId');
$search = $input->getOption('search');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Apps/AppWebserverCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$appId = $input->getArgument('appId');
$serverType = $input->getArgument('type');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Apps/CreateAppCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$multi = $input->getOption('multisite');

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Apps/DisableAppCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$token = $this->token->token;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Apps/DomainAddCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$appId = $input->getArgument('appId');
$domain = $input->getArgument('domain');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Apps/DomainMakePrimaryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$appId = $input->getArgument('appId');
$domainId = $input->getArgument('domainId');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Apps/DomainRemoveCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$appId = $input->getArgument('appId');
$domain = $input->getArgument('domainId');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Apps/GetAppBackupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$appId = $input->getArgument('appId');
$backupId = $input->getOption('backupId');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Apps/GetAppCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$appId = $input->getArgument('appId');
$token = $this->token->token;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$token = $this->token->token;
$output->writeln('Create integration initiated.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$token = $this->token->token;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$token = $this->token->token;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Apps/ListAppsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$accountId = $input->getArgument('account');
$token = $this->token->token;
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Apps/RemoveAppCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$token = $this->token->token;

Expand Down
2 changes: 1 addition & 1 deletion src/Command/Ares/RedirectsGetCsvCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$appId = (int) $input->getArgument('appId');
$filename = $input->getArgument('filename');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Ares/RedirectsUploadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$appId = (int) $input->getArgument('appId');
$file = $input->getArgument('file');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Auth/ClientLoginCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function configure()
;
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
if ($output->isDebug())
{
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Auth/LoginCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function configure()
;
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
if ($output->isDebug())
{
Expand Down
2 changes: 1 addition & 1 deletion src/Command/Auth/LogoutCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct($name = 'auth:logout')
parent::__construct($name);
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$token = new OauthToken();
$token->deleteSaved();
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/AppCertUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$certId = $input->getArgument('certID');
$aliasId = $input->getArgument('aliasID');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/CSRCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
if ($output->isDebug()) {
$this->api->setDebug();
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/CSRListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
if ($output->isDebug()) {
$this->api->setDebug();
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/CertActivateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$r = $this->api->activateCertForApp(
$this->token->token,
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/CertAddCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
if ($output->isDebug()) {
$this->api->setDebug();
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/CertGetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
if ($output->isDebug()) {
$this->api->setDebug();
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/CertImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
if ($output->isDebug()) {
$this->api->setDebug();
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/CertLinkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$certId = $input->getArgument('certID');
$aliasId = $input->getArgument('aliasID');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/CertListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$accountId = $input->getOption('accountID');
$appId = $input->getOption('appId');
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/LetsencryptCertCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$r = $this->api->letsencryptGetCertificate(
$this->token->token,
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/LetsencryptJobStatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$r = $this->api->getLetsencryptStatus(
$this->token->token,
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/LetsencryptRegisterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$r = $this->api->letsencryptRegister(
$this->token->token,
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/LetsencryptRenewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function configure()
;
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
try {
$r = $this->api->letsencryptRenew(
Expand Down
2 changes: 1 addition & 1 deletion src/Command/SSL/SearchLinkedCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function configure()
$this->addOauthOptions();
}

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$appId = $input->getArgument('appId');
$r = $this->api->searchLinkedCerts($this->token->token, $appId);
Expand Down
9 changes: 4 additions & 5 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
namespace Pagely\AtomicClient;

use Auryn\Injector;
use Dotenv\Dotenv;
use Dotenv\Exception\InvalidPathException;
use Monolog\Logger;
use Monolog\Handler\NullHandler;
Expand Down Expand Up @@ -43,7 +42,7 @@ public function cachedClientAuth(

if (file_exists($config))
{
$dotenv = new Dotenv(dirname($config), basename($config));
$dotenv = \Dotenv\Dotenv::createImmutable(dirname($config), basename($config));
$dotenv->load();
}

Expand Down Expand Up @@ -86,7 +85,7 @@ public function loadConfig($baseDir)
try
{
$home = getenv('HOME');
$dotenv = new Dotenv($home, $staging ? '/.atomic-staging' : '/.atomic');
$dotenv = \Dotenv\Dotenv::createImmutable($home, $staging ? '/.atomic-staging' : '/.atomic');
$dotenv->load();
}
catch (InvalidPathException $e)
Expand All @@ -96,7 +95,7 @@ public function loadConfig($baseDir)

try
{
$dotenv = new Dotenv($baseDir, $staging ? '/.env-staging' : '/.env');
$dotenv = \Dotenv\Dotenv::createImmutable($baseDir, $staging ? '/.env-staging' : '/.env');
$dotenv->load();
}
catch (InvalidPathException $e)
Expand All @@ -105,7 +104,7 @@ public function loadConfig($baseDir)
}

// doesn't overwrite so defaults get loaded last
$dotenv = new Dotenv($baseDir, $staging ? '/.env.staging' : '/.env.defaults');
$dotenv = \Dotenv\Dotenv::createImmutable($baseDir, $staging ? '/.env-staging' : '/.env.defaults');
$dotenv->load();
}
}

0 comments on commit c4d90f4

Please sign in to comment.