Conditions | 1 |
Paths | 1 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 1.037 |
Changes | 0 |
1 | <?php |
||
13 | 1 | public static function build(): iterable |
|
14 | { |
||
15 | 1 | yield 'configuration' => fn () => [ |
|
16 | 1 | 'type' => Type::nonNull(Type::string()), |
|
17 | 1 | 'description' => 'Return configuration value for given key. The value might be any format (HTML, JSON, text) as defined by client', |
|
18 | 1 | 'args' => [ |
|
19 | 1 | 'key' => Type::nonNull(Type::string()), |
|
20 | 1 | ], |
|
21 | 1 | 'resolve' => function ($root, array $args): string { |
|
22 | $key = $args['key']; |
||
23 | |||
24 | /** @var ConfigurationRepository $configurationRepository */ |
||
25 | $configurationRepository = _em()->getRepository(\Application\Model\Configuration::class); |
||
26 | $configuration = $configurationRepository->getOrCreate($key); |
||
27 | |||
28 | return $configuration->getValue(); |
||
29 | 1 | }, |
|
33 |