1 | <?php |
||
12 | abstract class base_mapper implements mapper_interface |
||
13 | { |
||
14 | /** @var \phpbb\db\driver\driver_interface */ |
||
15 | protected $db; |
||
16 | |||
17 | /** @var \blitze\sitemaker\model\base_collection */ |
||
18 | protected $collection; |
||
19 | |||
20 | /** @var \blitze\sitemaker\model\mapper_factory */ |
||
21 | protected $mapper_factory; |
||
22 | |||
23 | /** @var string */ |
||
24 | protected $entity_table; |
||
25 | |||
26 | /** @var string */ |
||
27 | protected $entity_class; |
||
28 | |||
29 | /** @var string */ |
||
30 | protected $entity_pkey; |
||
31 | |||
32 | /** |
||
33 | * Constructor |
||
34 | * |
||
35 | * @param \phpbb\db\driver\driver_interface $db Database object |
||
36 | * @param \blitze\sitemaker\model\base_collection $collection Entity collection |
||
37 | * @param \blitze\sitemaker\model\mapper_factory $mapper_factory Mapper factory object |
||
38 | * @param string $entity_table |
||
39 | */ |
||
40 | 117 | public function __construct(\phpbb\db\driver\driver_interface $db, \blitze\sitemaker\model\base_collection $collection, \blitze\sitemaker\model\mapper_factory $mapper_factory, $entity_table) |
|
47 | |||
48 | /** |
||
49 | * Get the collection |
||
50 | */ |
||
51 | public function get_collection() |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | 55 | public function load(array $condition = array()) |
|
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | 42 | public function find(array $condition = array()) |
|
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | 26 | public function save(\blitze\sitemaker\model\entity_interface $entity) |
|
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | 15 | public function delete($condition) |
|
125 | |||
126 | /** |
||
127 | 71 | * {@inheritdoc} |
|
128 | */ |
||
129 | 71 | public function create_entity(array $row) |
|
133 | |||
134 | /** |
||
135 | * Insert a new row in the table corresponding to the specified entity |
||
136 | * @param \blitze\sitemaker\model\entity_interface $entity |
||
137 | * @return \blitze\sitemaker\model\entity_interface |
||
138 | 11 | * @throws \blitze\sitemaker\exception\unexpected_value |
|
139 | */ |
||
140 | 11 | protected function insert(\blitze\sitemaker\model\entity_interface $entity) |
|
154 | |||
155 | /** |
||
156 | * Update the row in the table corresponding to the specified entity |
||
157 | * @param \blitze\sitemaker\model\entity_interface $entity |
||
158 | * @return mixed |
||
159 | 16 | * @throws \blitze\sitemaker\exception\unexpected_value |
|
160 | */ |
||
161 | 16 | protected function update(\blitze\sitemaker\model\entity_interface $entity) |
|
174 | |||
175 | /** |
||
176 | * @param array $sql_where |
||
177 | 28 | * @return string |
|
178 | */ |
||
179 | 28 | protected function find_sql(array $sql_where) |
|
184 | |||
185 | /** |
||
186 | * @param array $condition |
||
187 | 107 | * @return array |
|
188 | */ |
||
189 | 107 | protected function get_sql_condition(array $condition) |
|
215 | |||
216 | /** |
||
217 | * @param array $condition |
||
218 | 107 | * @return mixed |
|
219 | */ |
||
220 | 107 | protected function ensure_multi_array(array $condition) |
|
224 | } |
||
225 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.