Completed
Push — master ( 47778c...ba169d )
by Dan Michael O.
10:36
created

LazyResourceList::all()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Scriptotek\Alma\Model;
4
5
/**
6
 * The LazyResourceList extends the LazyResource class with functionality for
7
 * working with lists of resources, such as holdings, items, loans, etc.
8
 */
9
abstract class LazyResourceList extends LazyResource implements \Countable
10
{
11
    /* @var array */
12
    protected $resources = [];
13
14
    /**
15
     * Get all the resources.
16
     *
17
     * @return array
18
     */
19
    public function all()
20
    {
21
        return $this->init()->resources;
22
    }
23
24
    /**
25
     * Number of resources.
26
     *
27
     * @link http://php.net/manual/en/countable.count.php
28
     *
29
     * @return int The number of resources as an integer.
30
     */
31
    public function count()
32
    {
33
        return count($this->all());
34
    }
35
}
36