StringCollection::push()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 1
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