1 | <?php |
||
12 | class Pages { |
||
13 | |||
14 | /** |
||
15 | * @var Page[] |
||
16 | */ |
||
17 | private $pages; |
||
18 | |||
19 | /** |
||
20 | * @param Page[] $pages |
||
21 | */ |
||
22 | 4 | public function __construct( $pages = array() ) { |
|
26 | |||
27 | /** |
||
28 | * @param Page[]|Pages $pages |
||
29 | * |
||
30 | * @throws InvalidArgumentException |
||
31 | */ |
||
32 | 4 | public function addPages( $pages ) { |
|
33 | 4 | if( !is_array( $pages ) && !$pages instanceof Pages ) { |
|
34 | throw new InvalidArgumentException( '$pages needs to either be an array or a Pages object' ); |
||
35 | } |
||
36 | 4 | if( $pages instanceof Pages ) { |
|
37 | 1 | $pages = $pages->toArray(); |
|
38 | 1 | } |
|
39 | 4 | foreach( $pages as $page ) { |
|
40 | 4 | $this->addPage( $page ); |
|
41 | 4 | } |
|
42 | 4 | } |
|
43 | |||
44 | /** |
||
45 | * @param Page $page |
||
46 | */ |
||
47 | 4 | public function addPage( Page $page ) { |
|
50 | |||
51 | /** |
||
52 | * @param int $id |
||
53 | * |
||
54 | * @return bool |
||
55 | */ |
||
56 | public function hasPageWithId( $id ){ |
||
59 | |||
60 | /** |
||
61 | * @param Page $page |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | public function hasPage( Page $page ){ |
||
68 | |||
69 | /** |
||
70 | * @return Page|null Page or null if there is no page |
||
71 | */ |
||
72 | public function getLatest() { |
||
78 | |||
79 | |||
80 | /** |
||
81 | * @param int $pageid |
||
82 | * |
||
83 | * @throws RuntimeException |
||
84 | * @return Page |
||
85 | */ |
||
86 | public function get( $pageid ){ |
||
92 | |||
93 | /** |
||
94 | * @return Page[] |
||
95 | */ |
||
96 | 4 | public function toArray() { |
|
99 | } |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.