StringCollection::fetch()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Carpenstar\ByBitAPI\Core\Objects\Collection;
4
5
class StringCollection extends AbstractCollection
6
{
7
    /**
8
     * @param string|null $item
9
     * @return $this
10
     */
11
    public function push(?string $item = null): self
12
    {
13
        $this->collection[0] = $item;
14
        return $this;
15
    }
16
17
    /**
18
     * @return string
19
     */
20
    public function fetch(): ?string
21
    {
22
        $item = current($this->collection);
23
        next($this->collection);
24
        return is_bool($item) ? null : $item;
25
    }
26
}
27