Passed
Push — master ( 373e60...256112 )
by Dmitry
25:12 queued 10:02
created

SumsHydrator::extract()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
1
<?php declare(strict_types=1);
2
3
namespace hiqdev\php\billing\price;
4
5
use hiqdev\DataMapper\Hydrator\GeneratedHydrator;
0 ignored issues
show
Bug introduced by
The type hiqdev\DataMapper\Hydrator\GeneratedHydrator was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class SumsHydrator extends GeneratedHydrator
8
{
9
    public function hydrate(array $data, $object): object
10
    {
11
        if (!isset($data['sums'])) {
12
            throw new PriceInvalidArgumentException('Missing required key: sums');
13
        }
14
        return new Sums($data['sums']);
15
    }
16
17
    /**
18
     * {@inheritdoc}
19
     * @param Sums $object
20
     */
21
    public function extract($object): array
22
    {
23
        return [
24
            'values'  => $object->values(),
25
        ];
26
    }
27
}
28