1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace BitWasp\Bitcoind\Config; |
||
6 | |||
7 | use BitWasp\Bitcoind\Exception\BitcoindException; |
||
8 | |||
9 | class FilesystemWriter extends Writer |
||
10 | { |
||
11 | 10 | public function save(string $filePath, Config $config) |
|
12 | { |
||
13 | 10 | $file = ""; |
|
14 | 10 | foreach ($config->all() as $key => $option) { |
|
15 | 10 | $file .= "{$key}={$option}\n"; |
|
16 | } |
||
17 | 10 | if (!file_put_contents($filePath, $file)) { |
|
18 | throw new BitcoindException("Failed to write config file"); |
||
19 | } |
||
20 | 10 | } |
|
21 | |||
22 | 10 | public function create(string $filePath, Config $config) |
|
23 | { |
||
24 | 10 | if (file_exists($filePath)) { |
|
25 | 1 | throw new BitcoindException("Cannot overwrite existing files with FilesystemWriter::create"); |
|
26 | } |
||
27 | |||
28 | 9 | return $this->save($filePath, $config); |
|
0 ignored issues
–
show
|
|||
29 | } |
||
30 | } |
||
31 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.