|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
// 15.03.23 |
|
5
|
|
|
|
|
6
|
|
|
namespace AlecRabbit\Spinner\Core\Defaults\A; |
|
7
|
|
|
|
|
8
|
|
|
use AlecRabbit\Spinner\Core\Defaults\Contract\IDefaults; |
|
9
|
|
|
use AlecRabbit\Spinner\Core\Defaults\Contract\IDriverSettings; |
|
10
|
|
|
use AlecRabbit\Spinner\Core\Defaults\Mixin\DefaultsConst; |
|
11
|
|
|
|
|
12
|
|
|
abstract class ADriverSettings extends ADefaultsChild implements IDriverSettings |
|
13
|
|
|
{ |
|
14
|
|
|
use DefaultsConst; |
|
15
|
|
|
|
|
16
|
|
|
protected static string $messageOnFinalize; |
|
17
|
|
|
protected static string $messageOnExit; |
|
18
|
|
|
protected static string $messageOnInterrupt; |
|
19
|
|
|
|
|
20
|
|
|
private static ?IDriverSettings $objInstance = null; |
|
21
|
|
|
|
|
22
|
|
|
final protected function __construct(IDefaults $parent) |
|
23
|
|
|
{ |
|
24
|
|
|
parent::__construct($parent); |
|
25
|
|
|
$this->reset(); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
protected function reset(): void |
|
29
|
|
|
{ |
|
30
|
|
|
static::$messageOnFinalize = static::MESSAGE_ON_FINALIZE; |
|
|
|
|
|
|
31
|
|
|
static::$messageOnExit = static::MESSAGE_ON_EXIT; |
|
|
|
|
|
|
32
|
|
|
static::$messageOnInterrupt = static::MESSAGE_ON_INTERRUPT; |
|
|
|
|
|
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
final public static function getInstance(IDefaults $parent): IDriverSettings |
|
36
|
|
|
{ |
|
37
|
|
|
if (null === self::$objInstance) { |
|
38
|
|
|
self::$objInstance = |
|
39
|
|
|
new class ($parent) extends ADriverSettings { |
|
40
|
|
|
}; |
|
41
|
|
|
} |
|
42
|
|
|
return self::$objInstance; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function getInterruptMessage(): string |
|
46
|
|
|
{ |
|
47
|
|
|
return static::$messageOnInterrupt; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function getFinalMessage(): string |
|
51
|
|
|
{ |
|
52
|
|
|
return static::$messageOnFinalize; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function setFinalMessage(string $finalMessage): static |
|
56
|
|
|
{ |
|
57
|
|
|
static::$messageOnFinalize = $finalMessage; |
|
58
|
|
|
return $this; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function setInterruptMessage(string $interruptMessage): static |
|
62
|
|
|
{ |
|
63
|
|
|
static::$messageOnInterrupt = $interruptMessage; |
|
64
|
|
|
return $this; |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|