AbstractAkeneoApiReadStream::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\Stream\Akeneo;
9
10
use SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Service\AkeneoPimMiddlewareConnectorToAkeneoPimServiceInterface;
11
use SprykerMiddleware\Shared\Process\Stream\ReadStreamInterface;
0 ignored issues
show
Bug introduced by
The type SprykerMiddleware\Shared...eam\ReadStreamInterface 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...
12
use SprykerMiddleware\Shared\Process\Stream\StreamInterface;
0 ignored issues
show
Bug introduced by
The type SprykerMiddleware\Shared...\Stream\StreamInterface 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...
13
14
abstract class AbstractAkeneoApiReadStream implements StreamInterface, ReadStreamInterface
15
{
16
    /**
17
     * @var \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Service\AkeneoPimMiddlewareConnectorToAkeneoPimServiceInterface
18
     */
19
    protected $akeneoPimService;
20
21
    /**
22
     * @var \SprykerEco\Service\AkeneoPim\Dependencies\External\Api\Wrapper\AkeneoResourceCursorInterface
0 ignored issues
show
Bug introduced by
The type SprykerEco\Service\Akene...ResourceCursorInterface 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...
23
     */
24
    protected $cursor;
25
26
    /**
27
     * @param \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Dependency\Service\AkeneoPimMiddlewareConnectorToAkeneoPimServiceInterface $akeneoPimService
28
     */
29
    public function __construct(AkeneoPimMiddlewareConnectorToAkeneoPimServiceInterface $akeneoPimService)
30
    {
31
        $this->akeneoPimService = $akeneoPimService;
32
    }
33
34
    /**
35
     * @return array
36
     */
37
    public function read(): array
38
    {
39
        return $this->get();
40
    }
41
42
    /**
43
     * @return array
44
     */
45
    public function get(): array
46
    {
47
        $item = $this->cursor
48
            ->current();
49
        $this->cursor->next();
50
51
        return $item;
52
    }
53
54
    /**
55
     * @return bool
56
     */
57
    abstract public function open(): bool;
58
59
    /**
60
     * @return bool
61
     */
62
    public function close(): bool
63
    {
64
        unset($this->cursor);
65
66
        return true;
67
    }
68
69
    /**
70
     * @param int $offset
71
     * @param int $whence
72
     *
73
     * @return int
74
     */
75
    public function seek(int $offset, int $whence): int
76
    {
77
        return -1;
78
    }
79
80
    /**
81
     * @return bool
82
     */
83
    public function eof(): bool
84
    {
85
        return !$this->cursor->valid();
86
    }
87
}
88