Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Ignore basic methods, improving code coverage.
James Coleba01c4bbe8ed
diff --git a/app/Services/Github/Object/GithubObject.php b/app/Services/Github/Object/GithubObject.phpindex 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.phpindex 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 GithubObjectdiff --git a/app/Services/Internal/File/EncryptService.php b/app/Services/Internal/File/EncryptService.phpindex 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 EncryptServicediff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.phpindex 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.phpindex 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.phpindex 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 SpectreExceptiondiff --git a/app/Services/Spectre/Exception/SpectreException.php b/app/Services/Spectre/Exception/SpectreException.phpindex 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 Exceptiondiff --git a/app/Services/Spectre/Exception/WrongRequestFormatException.php b/app/Services/Spectre/Exception/WrongRequestFormatException.phpindex 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 SpectreExceptiondiff --git a/app/Services/Spectre/Object/Account.php b/app/Services/Spectre/Object/Account.phpindex 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 SpectreObjectprivate $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 SpectreObjectreturn $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 SpectreObjectreturn $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.phpindex 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 SpectreObjectprivate $failErrorClass;/** @var string */private $failMessage;+ /** @var array */+ private $fetchScopes = [];/** @var bool */private $finished;/** @var bool */@@ -84,12 +87,10 @@ class Attempt extends SpectreObjectprivate $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.phpindex 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 SpectreObjectdiff --git a/app/Services/Spectre/Object/Holder.php b/app/Services/Spectre/Object/Holder.phpindex 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 SpectreObjectdiff --git a/app/Services/Spectre/Object/Login.php b/app/Services/Spectre/Object/Login.phpindex 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,49 +69,6 @@ class Login extends SpectreObject/** @var Carbon */private $updatedAt;- /**- * @return string- */- public function getCountryCode(): string- {- return $this->countryCode;- }-- /**- * @return Carbon- */- public function getLastSuccessAt(): Carbon- {- return $this->lastSuccessAt;- }-- /**- * @return string- */- public function getProviderName(): string- {- return $this->providerName;- }-- /**- * @return string- */- public function getStatus(): string- {- return $this->status;- }-- /**- * @return Carbon- */- public function getUpdatedAt(): Carbon- {- return $this->updatedAt;- }----/*** Login constructor.*@@ -139,6 +97,14 @@ class Login extends SpectreObject}+ /**+ * @return string+ */+ public function getCountryCode(): string+ {+ return $this->countryCode;+ }+/*** @return int*/@@ -155,6 +121,38 @@ class Login extends SpectreObjectreturn $this->lastAttempt;}+ /**+ * @return Carbon+ */+ public function getLastSuccessAt(): Carbon+ {+ return $this->lastSuccessAt;+ }++ /**+ * @return string+ */+ public function getProviderName(): string+ {+ return $this->providerName;+ }++ /**+ * @return string+ */+ public function getStatus(): string+ {+ return $this->status;+ }++ /**+ * @return Carbon+ */+ public function getUpdatedAt(): Carbon+ {+ return $this->updatedAt;+ }+/*** @return array*/diff --git a/app/Services/Spectre/Object/SpectreObject.php b/app/Services/Spectre/Object/SpectreObject.phpindex 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 SpectreObjectdiff --git a/app/Services/Spectre/Object/Token.php b/app/Services/Spectre/Object/Token.phpindex 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 SpectreObjectdiff --git a/app/Services/Spectre/Object/Transaction.php b/app/Services/Spectre/Object/Transaction.phpindex 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 SpectreObjectdiff --git a/app/Services/Spectre/Object/TransactionExtra.php b/app/Services/Spectre/Object/TransactionExtra.phpindex 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 SpectreObjectdiff --git a/app/Services/Spectre/Request/CreateTokenRequest.php b/app/Services/Spectre/Request/CreateTokenRequest.phpindex 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.phpindex 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.phpindex 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.phpindex 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.phpindex b9e5722e6e..6b735de91b 100644--- a/app/Services/Spectre/Request/SpectreRequest.php+++ b/app/Services/Spectre/Request/SpectreRequest.php@@ -53,6 +53,7 @@ abstract class SpectreRequestabstract 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