Skip to content

Commit d32e25c

Browse files
janedbalondrejmirtes
authored andcommitted
Drop unused NeonAdapter::dump
1 parent a9c36b7 commit d32e25c

File tree

1 file changed

+0
-54
lines changed

1 file changed

+0
-54
lines changed

src/DependencyInjection/NeonAdapter.php

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Nette\DI\Config\Adapter;
66
use Nette\DI\Config\Helpers;
7-
use Nette\DI\Definitions\Reference;
87
use Nette\DI\Definitions\Statement;
98
use Nette\DI\InvalidConfigurationException;
109
use Nette\Neon\Entity;
@@ -14,7 +13,6 @@
1413
use PHPStan\File\FileHelper;
1514
use PHPStan\File\FileReader;
1615
use function array_values;
17-
use function array_walk_recursive;
1816
use function count;
1917
use function dirname;
2018
use function implode;
@@ -155,58 +153,6 @@ public function process(array $arr, string $fileKey, string $file): array
155153
return $res;
156154
}
157155

158-
/**
159-
* @param mixed[] $data
160-
*/
161-
public function dump(array $data): string
162-
{
163-
array_walk_recursive(
164-
$data,
165-
static function (&$val): void {
166-
if (!($val instanceof Statement)) {
167-
return;
168-
}
169-
170-
$val = self::statementToEntity($val);
171-
},
172-
);
173-
return "# generated by Nette\n\n" . Neon::encode($data, Neon::BLOCK);
174-
}
175-
176-
private static function statementToEntity(Statement $val): Entity
177-
{
178-
array_walk_recursive(
179-
$val->arguments,
180-
static function (&$val): void {
181-
if ($val instanceof Statement) {
182-
$val = self::statementToEntity($val);
183-
} elseif ($val instanceof Reference) {
184-
$val = '@' . $val->getValue();
185-
}
186-
},
187-
);
188-
189-
$entity = $val->getEntity();
190-
if ($entity instanceof Reference) {
191-
$entity = '@' . $entity->getValue();
192-
} elseif (is_array($entity)) {
193-
if ($entity[0] instanceof Statement) {
194-
return new Entity(
195-
Neon::CHAIN,
196-
[
197-
self::statementToEntity($entity[0]),
198-
new Entity('::' . $entity[1], $val->arguments),
199-
],
200-
);
201-
} elseif ($entity[0] instanceof Reference) {
202-
$entity = '@' . $entity[0]->getValue() . '::' . $entity[1];
203-
} elseif (is_string($entity[0])) {
204-
$entity = $entity[0] . '::' . $entity[1];
205-
}
206-
}
207-
return new Entity($entity, $val->arguments);
208-
}
209-
210156
private function createFileHelperByFile(string $file): FileHelper
211157
{
212158
$dir = dirname($file);

0 commit comments

Comments
 (0)