mirror of
https://github.com/friendica/friendica
synced 2025-04-23 21:10:12 +00:00
Creating interfaces for Config/PConfig & fix tests
This commit is contained in:
parent
4835f1185f
commit
c1dbb25656
54 changed files with 349 additions and 285 deletions
|
@ -5,7 +5,7 @@ namespace Friendica\Console;
|
|||
use Asika\SimpleConsole\CommandArgsException;
|
||||
use Asika\SimpleConsole\Console;
|
||||
use Console_Table;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Friendica\Core\Config\IConfiguration;
|
||||
|
||||
/**
|
||||
* @brief Manage blocked servers
|
||||
|
@ -20,7 +20,7 @@ class ServerBlock extends Console
|
|||
protected $helpOptions = ['h', 'help', '?'];
|
||||
|
||||
/**
|
||||
* @var Configuration
|
||||
* @var IConfiguration
|
||||
*/
|
||||
private $config;
|
||||
|
||||
|
@ -49,7 +49,7 @@ HELP;
|
|||
return $help;
|
||||
}
|
||||
|
||||
public function __construct(Configuration $config, $argv = null)
|
||||
public function __construct(IConfiguration $config, $argv = null)
|
||||
{
|
||||
parent::__construct($argv);
|
||||
|
||||
|
@ -77,9 +77,9 @@ HELP;
|
|||
/**
|
||||
* Prints the whole list of blocked domains including the reason
|
||||
*
|
||||
* @param Configuration $config
|
||||
* @param IConfiguration $config
|
||||
*/
|
||||
private function printBlockedServers(Configuration $config)
|
||||
private function printBlockedServers(IConfiguration $config)
|
||||
{
|
||||
$table = new Console_Table();
|
||||
$table->setHeaders(['Domain', 'Reason']);
|
||||
|
@ -93,11 +93,11 @@ HELP;
|
|||
/**
|
||||
* Adds a server to the blocked list
|
||||
*
|
||||
* @param Configuration $config
|
||||
* @param IConfiguration $config
|
||||
*
|
||||
* @return int The return code (0 = success, 1 = failed)
|
||||
*/
|
||||
private function addBlockedServer(Configuration $config)
|
||||
private function addBlockedServer(IConfiguration $config)
|
||||
{
|
||||
if (count($this->args) < 2 || count($this->args) > 3) {
|
||||
throw new CommandArgsException('Add needs a domain and optional a reason.');
|
||||
|
@ -145,11 +145,11 @@ HELP;
|
|||
/**
|
||||
* Removes a server from the blocked list
|
||||
*
|
||||
* @param Configuration $config
|
||||
* @param IConfiguration $config
|
||||
*
|
||||
* @return int The return code (0 = success, 1 = failed)
|
||||
*/
|
||||
private function removeBlockedServer(Configuration $config)
|
||||
private function removeBlockedServer(IConfiguration $config)
|
||||
{
|
||||
if (count($this->args) !== 2) {
|
||||
throw new CommandArgsException('Remove needs a second parameter.');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue