mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Add method to indicate completeness.
This commit is contained in:
@@ -91,6 +91,22 @@ class BunqPrerequisites implements PrerequisitesInterface
|
||||
return !$hasApiKey || !$hasServerIP;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate if all prerequisites have been met.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isComplete(): bool
|
||||
{
|
||||
// is complete when user has entered both the API key
|
||||
// and his IP address.
|
||||
|
||||
$hasApiKey = $this->hasApiKey();
|
||||
$hasServerIP = $this->hasServerIP();
|
||||
|
||||
return $hasApiKey && $hasServerIP;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user for this Prerequisites-routine. Class is expected to implement and save this.
|
||||
*
|
||||
|
@@ -75,6 +75,17 @@ class FilePrerequisites implements PrerequisitesInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate if all prerequisites have been met.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isComplete(): bool
|
||||
{
|
||||
// has no prerequisites, so always return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user for this Prerequisites-routine. Class is expected to implement and save this.
|
||||
*
|
||||
|
@@ -53,6 +53,13 @@ interface PrerequisitesInterface
|
||||
*/
|
||||
public function hasPrerequisites(): bool;
|
||||
|
||||
/**
|
||||
* Indicate if all prerequisites have been met.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isComplete(): bool;
|
||||
|
||||
/**
|
||||
* Set the user for this Prerequisites-routine. Class is expected to implement and save this.
|
||||
*
|
||||
|
@@ -87,6 +87,29 @@ class SpectrePrerequisites implements PrerequisitesInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate if all prerequisites have been met.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isComplete(): bool
|
||||
{
|
||||
// return true when user has set the App Id and the Spectre Secret.
|
||||
$values = [
|
||||
Preferences::getForUser($this->user, 'spectre_app_id', false),
|
||||
Preferences::getForUser($this->user, 'spectre_secret', false),
|
||||
];
|
||||
$result = true;
|
||||
/** @var Preference $value */
|
||||
foreach ($values as $value) {
|
||||
if (false === $value->data || null === $value->data) {
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user for this Prerequisites-routine. Class is expected to implement and save this.
|
||||
*
|
||||
|
Reference in New Issue
Block a user