Completed
Push — master ( 7c623d...b84c7d )
by Siro Díaz
01:29
created

ListAbstract::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace DataStructures\Lists;
4
5
use DataStructures\Lists\Interfaces\ListInterface;
6
7
abstract class ListAbstract implements ListInterface {
8
    protected $size;
9
10
    /**
11
     * Binds to count() method. This is equal to make $this->tree->size().
12
     *
13
     * @return integer the tree size. 0 if it is empty.
14
     */
15
    public function count() {
16
        return $this->size;
17
    }
18
19
    /**
20
     * Returns the array size.
21
     *
22
     * @return int the length
23
     */
24
    public function size() : int {
25
        return $this->size;
26
    }
27
28
    /**
29
     * Checks if the list is empty.
30
     *
31
     * @return boolean true if is empty, else false.
32
     */
33
    public function empty() : bool {
34
        return $this->size === 0;
35
    }
36
}