Total Complexity | 8 |
Total Lines | 93 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class UserListModel extends MainModel |
||
12 | { |
||
13 | /** |
||
14 | * Username. |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | private $_user; |
||
19 | |||
20 | /** |
||
21 | * Either anime or manga. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | private $_type; |
||
26 | |||
27 | /** |
||
28 | * Anime/manga status. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | private $_status; |
||
33 | |||
34 | /** |
||
35 | * Default constructor. |
||
36 | * |
||
37 | * @param string $user |
||
38 | * @param string $type |
||
39 | * @param string $status |
||
40 | * @param string $parserArea |
||
41 | * |
||
42 | * @return void |
||
43 | */ |
||
44 | public function __construct($user, $type, $status, $parserArea = '#content') |
||
45 | { |
||
46 | $this->_user = $user; |
||
47 | $this->_type = $type; |
||
48 | $this->_status = $status; |
||
49 | $this->_url = $this->_myAnimeListUrl.'/'.$type.'list/'.$user.'?status='.$status; |
||
50 | $this->_parserArea = $parserArea; |
||
51 | |||
52 | parent::errorCheck($this); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Default call. |
||
57 | * |
||
58 | * @param string $method |
||
59 | * @param array $arguments |
||
60 | * |
||
61 | * @return array|string|int |
||
62 | */ |
||
63 | public function __call($method, $arguments) |
||
64 | { |
||
65 | if ($this->_error) { |
||
66 | return $this->_error; |
||
67 | } |
||
68 | |||
69 | return call_user_func_array([$this, $method], $arguments); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * Get user list. |
||
74 | * |
||
75 | * @return string |
||
76 | */ |
||
77 | private function getAllInfo() |
||
104 | } |
||
105 | } |
||
106 |
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: