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