| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 15 | 3 | public function addToContainer(Container $c) |
|
| 16 | { |
||
| 17 | 3 | if (!$c->has('bone-paseto')) { |
|
| 18 | 1 | throw new NotFoundException('Please add a bone-paseto array config with a key `sharedKey`'); |
|
| 19 | } |
||
| 20 | |||
| 21 | 2 | $config = $c->get('bone-paseto'); |
|
| 22 | 2 | $sharedKey = $config['sharedKey']; |
|
| 23 | 2 | $c[SymmetricKey::class] = new SymmetricKey($sharedKey); |
|
| 24 | |||
| 25 | 2 | $c[PasetoService::class] = $c->factory(function (Container $c) { |
|
| 26 | 2 | $key = $c->get(SymmetricKey::class); |
|
| 27 | |||
| 28 | 2 | return new PasetoService($key); |
|
| 29 | }); |
||
| 32 |