diff --git a/app/Services/Github/Object/GithubObject.php b/app/Services/Github/Object/GithubObject.php index c3f13ab04c..0b83f4bf58 100644 --- a/app/Services/Github/Object/GithubObject.php +++ b/app/Services/Github/Object/GithubObject.php @@ -23,7 +23,8 @@ declare(strict_types=1); namespace FireflyIII\Services\Github\Object; /** - * Class SpectreObject + * @codeCoverageIgnore + * Class GithubObject */ class GithubObject { diff --git a/app/Services/Github/Object/Release.php b/app/Services/Github/Object/Release.php index 33cfa91415..d9bf4ed408 100644 --- a/app/Services/Github/Object/Release.php +++ b/app/Services/Github/Object/Release.php @@ -27,6 +27,7 @@ use Carbon\Carbon; /** + * @codeCoverageIgnore * Class Release */ class Release extends GithubObject diff --git a/app/Services/Internal/File/EncryptService.php b/app/Services/Internal/File/EncryptService.php index e3a21e898e..4426e77100 100644 --- a/app/Services/Internal/File/EncryptService.php +++ b/app/Services/Internal/File/EncryptService.php @@ -23,8 +23,8 @@ declare(strict_types=1); namespace FireflyIII\Services\Internal\File; -use FireflyIII\Exceptions\FireflyException; use Crypt; +use FireflyIII\Exceptions\FireflyException; /** * Class EncryptService diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php index 41eb9af480..8c3875c138 100644 --- a/app/Services/Internal/Update/AccountUpdateService.php +++ b/app/Services/Internal/Update/AccountUpdateService.php @@ -51,7 +51,7 @@ class AccountUpdateService $account->iban = $data['iban']; $account->save(); - if(isset($data['currency_id']) && $data['currency_id'] === 0) { + if (isset($data['currency_id']) && $data['currency_id'] === 0) { unset($data['currency_id']); } diff --git a/app/Services/Internal/Update/TransactionUpdateService.php b/app/Services/Internal/Update/TransactionUpdateService.php index ee8bcaf9d9..c2f94d08e3 100644 --- a/app/Services/Internal/Update/TransactionUpdateService.php +++ b/app/Services/Internal/Update/TransactionUpdateService.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Services\Internal\Update; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Transaction; use FireflyIII\Services\Internal\Support\TransactionServiceTrait; use FireflyIII\User; diff --git a/app/Services/Spectre/Exception/DuplicatedCustomerException.php b/app/Services/Spectre/Exception/DuplicatedCustomerException.php index c735679bf6..2bbdc668b4 100644 --- a/app/Services/Spectre/Exception/DuplicatedCustomerException.php +++ b/app/Services/Spectre/Exception/DuplicatedCustomerException.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Services\Spectre\Exception; /** + * @codeCoverageIgnore * Class DuplicatedCustomerException */ class DuplicatedCustomerException extends SpectreException diff --git a/app/Services/Spectre/Exception/SpectreException.php b/app/Services/Spectre/Exception/SpectreException.php index e0539c95ff..b96c244325 100644 --- a/app/Services/Spectre/Exception/SpectreException.php +++ b/app/Services/Spectre/Exception/SpectreException.php @@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Exception; use Exception; /** + * @codeCoverageIgnore * Class SpectreException */ class SpectreException extends Exception diff --git a/app/Services/Spectre/Exception/WrongRequestFormatException.php b/app/Services/Spectre/Exception/WrongRequestFormatException.php index dea494a798..ba9a3be93c 100644 --- a/app/Services/Spectre/Exception/WrongRequestFormatException.php +++ b/app/Services/Spectre/Exception/WrongRequestFormatException.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Services\Spectre\Exception; /** + * @codeCoverageIgnore * Class WrongRequestFormatException */ class WrongRequestFormatException extends SpectreException diff --git a/app/Services/Spectre/Object/Account.php b/app/Services/Spectre/Object/Account.php index 8e476df911..fa7367b770 100644 --- a/app/Services/Spectre/Object/Account.php +++ b/app/Services/Spectre/Object/Account.php @@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Object; use Carbon\Carbon; /** + * @codeCoverageIgnore * Class Account */ class Account extends SpectreObject @@ -50,11 +51,24 @@ class Account extends SpectreObject private $updatedAt; /** - * @return string + * Account constructor. + * + * @param array $data */ - public function getNature(): string + public function __construct(array $data) { - return $this->nature; + $this->id = (int)$data['id']; + $this->loginId = $data['login_id']; + $this->currencyCode = $data['currency_code']; + $this->balance = $data['balance']; + $this->name = $data['name']; + $this->nature = $data['nature']; + $this->createdAt = new Carbon($data['created_at']); + $this->updatedAt = new Carbon($data['updated_at']); + + foreach ($data['extra'] as $key => $value) { + $this->extra[$key] = $value; + } } /** @@ -81,29 +95,6 @@ class Account extends SpectreObject return $this->extra; } - - - /** - * Account constructor. - * - * @param array $data - */ - public function __construct(array $data) - { - $this->id = (int)$data['id']; - $this->loginId = $data['login_id']; - $this->currencyCode = $data['currency_code']; - $this->balance = $data['balance']; - $this->name = $data['name']; - $this->nature = $data['nature']; - $this->createdAt = new Carbon($data['created_at']); - $this->updatedAt = new Carbon($data['updated_at']); - - foreach ($data['extra'] as $key => $value) { - $this->extra[$key] = $value; - } - } - /** * @return int */ @@ -120,6 +111,14 @@ class Account extends SpectreObject return $this->name; } + /** + * @return string + */ + public function getNature(): string + { + return $this->nature; + } + /** * @return array */ diff --git a/app/Services/Spectre/Object/Attempt.php b/app/Services/Spectre/Object/Attempt.php index 1bc5c6f882..6aecd25246 100644 --- a/app/Services/Spectre/Object/Attempt.php +++ b/app/Services/Spectre/Object/Attempt.php @@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Object; use Carbon\Carbon; /** + * @codeCoverageIgnore * Class Attempt */ class Attempt extends SpectreObject @@ -58,6 +59,8 @@ class Attempt extends SpectreObject private $failErrorClass; /** @var string */ private $failMessage; + /** @var array */ + private $fetchScopes = []; /** @var bool */ private $finished; /** @var bool */ @@ -84,12 +87,10 @@ class Attempt extends SpectreObject private $successAt; /** @var Carbon */ private $toDate; - /** @var Carbon */ - private $updatedAt; - /** @var string */ - private $userAgent; // undocumented - /** @var array */ - private $fetchScopes = []; + /** @var Carbon */ + private $updatedAt; // undocumented +/** @var string */ + private $userAgent; /** * Attempt constructor. @@ -114,7 +115,7 @@ class Attempt extends SpectreObject $this->failAt = new Carbon($data['fail_at']); $this->failErrorClass = $data['fail_error_class']; $this->failMessage = $data['fail_message']; - $this->fetchScopes = $data['fetch_scopes']; + $this->fetchScopes = $data['fetch_scopes']; $this->finished = $data['finished']; $this->finishedRecent = $data['finished_recent']; $this->fromDate = new Carbon($data['from_date']); @@ -185,7 +186,7 @@ class Attempt extends SpectreObject 'fail_at' => $this->failAt->toIso8601String(), 'fail_error_class' => $this->failErrorClass, 'fail_message' => $this->failMessage, - 'fetch_scopes' => $this->fetchScopes, + 'fetch_scopes' => $this->fetchScopes, 'finished' => $this->finished, 'finished_recent' => $this->finishedRecent, 'from_date' => $this->fromDate->toIso8601String(), diff --git a/app/Services/Spectre/Object/Customer.php b/app/Services/Spectre/Object/Customer.php index 36a08a3ccf..10b76424ca 100644 --- a/app/Services/Spectre/Object/Customer.php +++ b/app/Services/Spectre/Object/Customer.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Services\Spectre\Object; /** + * @codeCoverageIgnore * Class Customer */ class Customer extends SpectreObject diff --git a/app/Services/Spectre/Object/Holder.php b/app/Services/Spectre/Object/Holder.php index f7545a0283..ac07e953c0 100644 --- a/app/Services/Spectre/Object/Holder.php +++ b/app/Services/Spectre/Object/Holder.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Services\Spectre\Object; /** + * @codeCoverageIgnore * Class Holder */ class Holder extends SpectreObject diff --git a/app/Services/Spectre/Object/Login.php b/app/Services/Spectre/Object/Login.php index 5b217a444a..6a8fad38e7 100644 --- a/app/Services/Spectre/Object/Login.php +++ b/app/Services/Spectre/Object/Login.php @@ -27,6 +27,7 @@ use Carbon\Carbon; /** + * @codeCoverageIgnore * Class Login */ class Login extends SpectreObject @@ -68,6 +69,34 @@ class Login extends SpectreObject /** @var Carbon */ private $updatedAt; + /** + * Login constructor. + * + * @param array $data + */ + public function __construct(array $data) + { + $this->consentGivenAt = new Carbon($data['consent_given_at']); + $this->consentTypes = $data['consent_types']; + $this->countryCode = $data['country_code']; + $this->createdAt = new Carbon($data['created_at']); + $this->updatedAt = new Carbon($data['updated_at']); + $this->customerId = $data['customer_id']; + $this->dailyRefresh = $data['daily_refresh']; + $this->holderInfo = new Holder($data['holder_info']); + $this->id = (int)$data['id']; + $this->lastAttempt = new Attempt($data['last_attempt']); + $this->lastSuccessAt = new Carbon($data['last_success_at']); + $this->nextRefreshPossibleAt = new Carbon($data['next_refresh_possible_at']); + $this->providerCode = $data['provider_code']; + $this->providerId = $data['provider_id']; + $this->providerName = $data['provider_name']; + $this->showConsentConfirmation = $data['show_consent_confirmation']; + $this->status = $data['status']; + $this->storeCredentials = $data['store_credentials']; + + } + /** * @return string */ @@ -76,6 +105,22 @@ class Login extends SpectreObject return $this->countryCode; } + /** + * @return int + */ + public function getId(): int + { + return $this->id; + } + + /** + * @return Attempt + */ + public function getLastAttempt(): Attempt + { + return $this->lastAttempt; + } + /** * @return Carbon */ @@ -108,53 +153,6 @@ class Login extends SpectreObject return $this->updatedAt; } - - - - /** - * Login constructor. - * - * @param array $data - */ - public function __construct(array $data) - { - $this->consentGivenAt = new Carbon($data['consent_given_at']); - $this->consentTypes = $data['consent_types']; - $this->countryCode = $data['country_code']; - $this->createdAt = new Carbon($data['created_at']); - $this->updatedAt = new Carbon($data['updated_at']); - $this->customerId = $data['customer_id']; - $this->dailyRefresh = $data['daily_refresh']; - $this->holderInfo = new Holder($data['holder_info']); - $this->id = (int)$data['id']; - $this->lastAttempt = new Attempt($data['last_attempt']); - $this->lastSuccessAt = new Carbon($data['last_success_at']); - $this->nextRefreshPossibleAt = new Carbon($data['next_refresh_possible_at']); - $this->providerCode = $data['provider_code']; - $this->providerId = $data['provider_id']; - $this->providerName = $data['provider_name']; - $this->showConsentConfirmation = $data['show_consent_confirmation']; - $this->status = $data['status']; - $this->storeCredentials = $data['store_credentials']; - - } - - /** - * @return int - */ - public function getId(): int - { - return $this->id; - } - - /** - * @return Attempt - */ - public function getLastAttempt(): Attempt - { - return $this->lastAttempt; - } - /** * @return array */ diff --git a/app/Services/Spectre/Object/SpectreObject.php b/app/Services/Spectre/Object/SpectreObject.php index f731cdf317..57ecdb686e 100644 --- a/app/Services/Spectre/Object/SpectreObject.php +++ b/app/Services/Spectre/Object/SpectreObject.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Services\Spectre\Object; /** + * @codeCoverageIgnore * Class SpectreObject */ class SpectreObject diff --git a/app/Services/Spectre/Object/Token.php b/app/Services/Spectre/Object/Token.php index da0e3314ac..42c1263db2 100644 --- a/app/Services/Spectre/Object/Token.php +++ b/app/Services/Spectre/Object/Token.php @@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Object; use Carbon\Carbon; /** + * @codeCoverageIgnore * Class Token */ class Token extends SpectreObject diff --git a/app/Services/Spectre/Object/Transaction.php b/app/Services/Spectre/Object/Transaction.php index 48a8a4283e..58739d23e9 100644 --- a/app/Services/Spectre/Object/Transaction.php +++ b/app/Services/Spectre/Object/Transaction.php @@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Object; use Carbon\Carbon; /** + * @codeCoverageIgnore * Class Transaction */ class Transaction extends SpectreObject diff --git a/app/Services/Spectre/Object/TransactionExtra.php b/app/Services/Spectre/Object/TransactionExtra.php index 01538c1bd1..28ca9da498 100644 --- a/app/Services/Spectre/Object/TransactionExtra.php +++ b/app/Services/Spectre/Object/TransactionExtra.php @@ -26,6 +26,7 @@ namespace FireflyIII\Services\Spectre\Object; use Carbon\Carbon; /** + * @codeCoverageIgnore * Class TransactionExtra */ class TransactionExtra extends SpectreObject diff --git a/app/Services/Spectre/Request/CreateTokenRequest.php b/app/Services/Spectre/Request/CreateTokenRequest.php index 1705759daa..c700d7b78c 100644 --- a/app/Services/Spectre/Request/CreateTokenRequest.php +++ b/app/Services/Spectre/Request/CreateTokenRequest.php @@ -51,7 +51,7 @@ class CreateTokenRequest extends SpectreRequest $data = [ 'data' => [ 'customer_id' => $this->customer->getId(), - 'fetch_scopes' => ['accounts', 'transactions'], + 'fetch_scopes' => ['accounts', 'transactions'], 'daily_refresh' => true, 'include_fake_providers' => true, 'show_consent_confirmation' => true, diff --git a/app/Services/Spectre/Request/ListAccountsRequest.php b/app/Services/Spectre/Request/ListAccountsRequest.php index a1e87f72eb..eedb0d2382 100644 --- a/app/Services/Spectre/Request/ListAccountsRequest.php +++ b/app/Services/Spectre/Request/ListAccountsRequest.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Services\Spectre\Request; use FireflyIII\Exceptions\FireflyException; -use FireflyIII\Services\Spectre\Exception\SpectreException; use FireflyIII\Services\Spectre\Object\Account; use FireflyIII\Services\Spectre\Object\Login; use Log; diff --git a/app/Services/Spectre/Request/ListLoginsRequest.php b/app/Services/Spectre/Request/ListLoginsRequest.php index a81c034c38..49379bd96e 100644 --- a/app/Services/Spectre/Request/ListLoginsRequest.php +++ b/app/Services/Spectre/Request/ListLoginsRequest.php @@ -72,7 +72,7 @@ class ListLoginsRequest extends SpectreRequest $collection->push(new Login($loginArray)); } // sort logins by date created: - $sorted = $collection->sortByDesc( + $sorted = $collection->sortByDesc( function (Login $login) { return $login->getUpdatedAt()->timestamp; } diff --git a/app/Services/Spectre/Request/ListTransactionsRequest.php b/app/Services/Spectre/Request/ListTransactionsRequest.php index dfa8c566ff..1a9b419a0f 100644 --- a/app/Services/Spectre/Request/ListTransactionsRequest.php +++ b/app/Services/Spectre/Request/ListTransactionsRequest.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Services\Spectre\Request; use FireflyIII\Exceptions\FireflyException; -use FireflyIII\Services\Spectre\Exception\SpectreException; use FireflyIII\Services\Spectre\Object\Account; use FireflyIII\Services\Spectre\Object\Transaction; use Log; diff --git a/app/Services/Spectre/Request/SpectreRequest.php b/app/Services/Spectre/Request/SpectreRequest.php index b9e5722e6e..6b735de91b 100644 --- a/app/Services/Spectre/Request/SpectreRequest.php +++ b/app/Services/Spectre/Request/SpectreRequest.php @@ -53,6 +53,7 @@ abstract class SpectreRequest abstract public function call(): void; /** + * @codeCoverageIgnore * @return string */ public function getAppId(): string @@ -61,6 +62,8 @@ abstract class SpectreRequest } /** + * @codeCoverageIgnore + * * @param string $appId */ public function setAppId(string $appId): void @@ -69,6 +72,7 @@ abstract class SpectreRequest } /** + * @codeCoverageIgnore * @return string */ public function getSecret(): string @@ -77,6 +81,8 @@ abstract class SpectreRequest } /** + * @codeCoverageIgnore + * * @param string $secret */ public function setSecret(string $secret): void @@ -85,6 +91,7 @@ abstract class SpectreRequest } /** + * @codeCoverageIgnore * @return string */ public function getServer(): string @@ -93,6 +100,8 @@ abstract class SpectreRequest } /** + * @codeCoverageIgnore + * * @param string $privateKey */ public function setPrivateKey(string $privateKey): void