Remove default array definitions from class constructors

This commit is contained in:
DariusIII
2023-04-14 23:50:14 +02:00
parent 83aba3d408
commit 6bfdfae8f6
26 changed files with 235 additions and 592 deletions
+4 -22
View File
@@ -48,33 +48,15 @@ class PostProcess
private Nfo $Nfo;
/**
* Constructor.
*
* @param array $options Pass in class instances.
*
* @throws \Exception
*/
public function __construct(array $options = [])
public function __construct()
{
$defaults = [
'Echo' => true,
'Logger' => null,
'Groups' => null,
'NameFixer' => null,
'Nfo' => null,
'ReleaseFiles' => null,
'Settings' => null,
];
$options += $defaults;
// Various.
$this->echooutput = ($options['Echo'] && config('nntmux.echocli'));
$this->echooutput = config('nntmux.echocli');
// Class instances.
$this->_par2Info = new Par2Info();
$this->nameFixer = (($options['NameFixer'] instanceof NameFixer) ? $options['NameFixer'] : new NameFixer(['Echo' => $this->echooutput, 'Groups' => null]));
$this->Nfo = (($options['Nfo'] instanceof Nfo) ? $options['Nfo'] : new Nfo());
$this->nameFixer = new NameFixer();
$this->Nfo = new Nfo();
// Site settings.
$this->addpar2 = (int) Settings::settingValue('..addpar2') !== 0;