Total Complexity | 8 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class SuperAttributeAkeneoApiReadStream extends AbstractAkeneoApiReadStream |
||
11 | { |
||
12 | /** |
||
13 | * @var \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursor |
||
14 | */ |
||
15 | protected $cursorVariants; |
||
16 | |||
17 | protected const KEY_CODE = 'code'; |
||
18 | |||
19 | /** |
||
20 | * @return bool |
||
21 | */ |
||
22 | public function open(): bool |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * @return array |
||
32 | */ |
||
33 | public function get(): array |
||
34 | { |
||
35 | if (($this->cursorVariants !== null) && $this->cursorVariants->valid()) { |
||
36 | return $this->cursorVariants->current(); |
||
37 | } |
||
38 | |||
39 | $family = $this->cursor->current(); |
||
40 | $this->cursor->next(); |
||
41 | |||
42 | $this->cursorVariants = $this->akeneoPimService->getFamilyVariants($family[static::KEY_CODE]); |
||
43 | |||
44 | return $this->cursorVariants->valid() ? $this->cursorVariants->current() : []; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return bool |
||
49 | */ |
||
50 | public function eof(): bool |
||
57 | } |
||
58 | } |
||
59 |