Issues (76)

src/App/Manufacturer/Data/ManufacturerDTOArray.php (4 issues)

Labels
Severity
1
<?php
2
/**
3
 * File: ManufacturerDTOArray.php
4
 *
5
 * @author      Maciej Sławik <[email protected]>
6
 * Github:      https://github.com/maciejslawik
7
 */
8
9
namespace MSlwk\Otomoto\App\Manufacturer\Data;
10
11
use ArrayIterator;
12
use Iterator;
13
use IteratorIterator;
14
15
/**
16
 * Class ManufacturerDTOArray
17
 * @package MSlwk\Otomoto\App\Manufacturer\Data
18
 */
19
class ManufacturerDTOArray extends IteratorIterator implements Iterator
20
{
21
    /**
22
     * ManufacturerDTOArray constructor.
23
     * @param ManufacturerDTOInterface[]|null[] ...$manufacturerDTOs
24
     */
25 24
    public function __construct(?ManufacturerDTOInterface ...$manufacturerDTOs)
26
    {
27 24
        parent::__construct(new ArrayIterator($manufacturerDTOs));
28 24
    }
29
30
    /**
31
     * @return ManufacturerDTOInterface
32
     */
33 10
    public function current(): ManufacturerDTOInterface
34
    {
35 10
        return $this->getInnerIterator()->current();
36
    }
37
38
    /**
39
     * @param ManufacturerDTOInterface $manufacturerDTO
40
     */
41 5
    public function add(ManufacturerDTOInterface $manufacturerDTO): void
42
    {
43 5
        $this->getInnerIterator()->append($manufacturerDTO);
0 ignored issues
show
The method append() does not exist on Iterator. It seems like you code against a sub-type of Iterator such as AppendIterator or ArrayIterator or RecursiveArrayIterator. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

43
        $this->getInnerIterator()->/** @scrutinizer ignore-call */ append($manufacturerDTO);
Loading history...
44 5
    }
45
46
    /**
47
     * @param int $key
48
     * @param ManufacturerDTOInterface $manufacturerDTO
49
     */
50 3
    public function set(int $key, ManufacturerDTOInterface $manufacturerDTO): void
51
    {
52 3
        $this->getInnerIterator()->offsetSet($key, $manufacturerDTO);
0 ignored issues
show
The method offsetSet() does not exist on Iterator. It seems like you code against a sub-type of Iterator such as SplDoublyLinkedList or Yaf_Config_Simple or SplFixedArray or SplObjectStorage or Yaf\Session or TheSeer\Tokenizer\TokenCollection or Yaf_Session or Yaf\Config\Simple or Yaf\Config\Ini or SolrDocument or Yaf_Config_Ini or CachingIterator or PHP_Token_Stream or Phar or ArrayIterator or Phar or Phar or RecursiveCachingIterator or RecursiveArrayIterator or SimpleXMLIterator or Phar. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
        $this->getInnerIterator()->/** @scrutinizer ignore-call */ offsetSet($key, $manufacturerDTO);
Loading history...
53 3
    }
54
55
    /**
56
     * @param int $key
57
     * @return ManufacturerDTOInterface
58
     */
59 11
    public function get(int $key): ManufacturerDTOInterface
60
    {
61 11
        return $this->getInnerIterator()->offsetGet($key);
0 ignored issues
show
The method offsetGet() does not exist on Iterator. It seems like you code against a sub-type of Iterator such as SplDoublyLinkedList or Yaf_Config_Simple or SplFixedArray or SplObjectStorage or Yaf\Session or TheSeer\Tokenizer\TokenCollection or Yaf_Session or Yaf\Config\Simple or Yaf\Config\Ini or SolrDocument or Yaf_Config_Ini or CachingIterator or PHP_Token_Stream or Phar or ArrayIterator or Phar or Phar or RecursiveCachingIterator or RecursiveArrayIterator or SimpleXMLIterator or Phar. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

61
        return $this->getInnerIterator()->/** @scrutinizer ignore-call */ offsetGet($key);
Loading history...
62
    }
63
64
    /**
65
     * @return int
66
     */
67 6
    public function count(): int
68
    {
69 6
        return $this->getInnerIterator()->count();
0 ignored issues
show
The method count() does not exist on Iterator. It seems like you code against a sub-type of Iterator such as JsonSchema\Iterator\ObjectIterator or SplDoublyLinkedList or HttpMessage or HttpRequestPool or Yaf_Config_Simple or SplFixedArray or SplObjectStorage or Yaf\Session or SQLiteResult or MSlwk\Otomoto\App\Manufa...ta\ManufacturerDTOArray or Imagick or TheSeer\Tokenizer\TokenCollection or MSlwk\Otomoto\Middleware\Webpage\Data\UrlDTOArray or Yaf_Session or SplPriorityQueue or MSlwk\Otomoto\Middleware...ge\Data\WebpageDTOArray or Yaf\Config\Simple or MSlwk\Otomoto\App\Model\Data\ModelDTOArray or Yaf\Config\Ini or MSlwk\Otomoto\App\Stats\Filter\FilterArray or MongoCursor or Yaf_Config_Ini or SplHeap or MongoGridFSCursor or MSlwk\Otomoto\App\Manufa...ta\ManufacturerDTOArray or MSlwk\Otomoto\Middleware\Webpage\Data\UrlDTOArray or MSlwk\Otomoto\Middleware...ge\Data\WebpageDTOArray or CachingIterator or MSlwk\Otomoto\App\Model\Data\ModelDTOArray or MSlwk\Otomoto\App\Stats\Filter\FilterArray or PHP_Token_Stream or Phar or ArrayIterator or GlobIterator or Phar or Phar or RecursiveCachingIterator or RecursiveArrayIterator or SimpleXMLIterator or Phar. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

69
        return $this->getInnerIterator()->/** @scrutinizer ignore-call */ count();
Loading history...
70
    }
71
}
72