1 | <?php |
||
10 | class Catalog implements \Countable |
||
11 | { |
||
12 | /** |
||
13 | * @var array |
||
14 | */ |
||
15 | private $products; |
||
16 | |||
17 | /** |
||
18 | * Creates a new Catalog instance from the given Product models |
||
19 | * |
||
20 | * @param array $products A list of Product models |
||
21 | */ |
||
22 | 3 | public function __construct(array $products) |
|
26 | |||
27 | /** |
||
28 | * Get a list of all Product models in this catalog |
||
29 | * |
||
30 | * @return array |
||
31 | */ |
||
32 | public function getProducts() |
||
33 | { |
||
34 | return $this->products; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Get the number of products in this catalog |
||
39 | * |
||
40 | * @see \Countable |
||
41 | * |
||
42 | * @return integer |
||
43 | */ |
||
44 | 1 | public function count() |
|
48 | } |