Total Complexity | 7 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
14 | class MassSchemator implements MassSchematorInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var SchematorInterface Schemator instance |
||
18 | */ |
||
19 | protected SchematorInterface $schemator; |
||
20 | |||
21 | /** |
||
22 | * MassSchemator constructor. |
||
23 | * @param SchematorInterface $schemator Schemator instance |
||
24 | */ |
||
25 | public function __construct(SchematorInterface $schemator) |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @inheritDoc |
||
32 | */ |
||
33 | public function generate(iterable $source, array $schema): Generator |
||
34 | { |
||
35 | foreach($source as $item) { |
||
36 | yield $this->schemator->exec($item, $schema); |
||
|
|||
37 | } |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @inheritDoc |
||
42 | */ |
||
43 | public function convert(iterable $source, array $schema): array |
||
44 | { |
||
45 | $gen = $this->generate($source, $schema); |
||
46 | $result = []; |
||
47 | |||
48 | foreach($gen as $item) { |
||
49 | $result[] = $item; |
||
50 | } |
||
51 | |||
52 | return $result; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @inheritDoc |
||
57 | * @deprecated please use convert() method |
||
58 | * @see MassSchematorInterface::convert() |
||
59 | */ |
||
60 | public function exec(iterable $source, array $schema): array |
||
70 | } |
||
71 | } |
||
72 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.