This repository was archived by the owner on Oct 25, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+ /*
3+ * This file is part of the DiscogsAPI PHP SDK.
4+ *
5+ * (c) Richard van den Brand <richard@vandenbrand.org>
6+ *
7+ * For the full copyright and license information, please view the LICENSE
8+ * file that was distributed with this source code.
9+ */
10+
11+ namespace Discogs \Model ;
12+
13+ class Inventory implements \Countable, \IteratorAggregate
14+ {
15+ protected $ pagination ;
16+ protected $ listings ;
17+
18+ public function setPagination ($ pagination )
19+ {
20+ $ this ->pagination = $ pagination ;
21+ }
22+
23+ public function getPagination ()
24+ {
25+ return $ this ->pagination ;
26+ }
27+
28+ public function setListings ($ listings )
29+ {
30+ $ this ->listings = $ listings ;
31+ }
32+
33+ public function getListings ()
34+ {
35+ return $ this ->listings ;
36+ }
37+
38+ public function count ()
39+ {
40+ return $ this ->getPagination ()->getItems ();
41+ }
42+
43+ public function getIterator ()
44+ {
45+ return new \ArrayIterator ($ this ->listings );
46+ }
47+ }
Original file line number Diff line number Diff line change @@ -140,6 +140,8 @@ protected function getClass($path)
140140 $ key = 'resultset ' ;
141141 } else if (preg_match ('#^/(artists|releases|masters|labels)/#i ' , $ path , $ matches )) {
142142 $ key = $ this ->getSingular ($ matches [1 ]);
143+ } else if (preg_match ('#^/users/[\d\w_-]+/inventory#i ' , $ path , $ matches )) {
144+ $ key = 'inventory ' ;
143145 } else {
144146 $ key = '' ;
145147 }
You can’t perform that action at this time.
0 commit comments