1 | <?php |
||
42 | class D7Model extends BaseBitrixModel |
||
43 | { |
||
44 | const TABLE_CLASS = null; |
||
45 | |||
46 | /** |
||
47 | * @var null|string |
||
48 | */ |
||
49 | protected static $cachedTableClass = null; |
||
50 | |||
51 | /** |
||
52 | * Adapter to interact with Bitrix D7 API. |
||
53 | * |
||
54 | * @var D7Adapter |
||
55 | */ |
||
56 | protected static $adapter; |
||
57 | |||
58 | /** |
||
59 | * Constructor. |
||
60 | * |
||
61 | * @param $id |
||
62 | * @param $fields |
||
63 | */ |
||
64 | public function __construct($id = null, $fields = null) |
||
70 | |||
71 | /** |
||
72 | * Setter for adapter (for testing) |
||
73 | * @param $adapter |
||
74 | */ |
||
75 | public static function setAdapter($adapter) |
||
79 | |||
80 | /** |
||
81 | * Instantiate adapter if it's not instantiated. |
||
82 | * |
||
83 | * @return D7Adapter |
||
84 | */ |
||
85 | public static function instantiateAdapter() |
||
93 | |||
94 | /** |
||
95 | * Instantiate a query object for the model. |
||
96 | * |
||
97 | * @return D7Query |
||
98 | */ |
||
99 | public static function query() |
||
103 | |||
104 | /** |
||
105 | * @return string |
||
106 | * @throws LogicException |
||
107 | */ |
||
108 | public static function tableClass() |
||
117 | |||
118 | /** |
||
119 | * Cached version of table class. |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | public static function cachedTableClass() |
||
131 | |||
132 | /** |
||
133 | * Internal part of create to avoid problems with static and inheritance |
||
134 | * |
||
135 | * @param $fields |
||
136 | * |
||
137 | * @throws ExceptionFromBitrix |
||
138 | * |
||
139 | * @return static|bool |
||
140 | */ |
||
141 | protected static function internalCreate($fields) |
||
162 | |||
163 | /** |
||
164 | * Delete model |
||
165 | * |
||
166 | * @return bool |
||
167 | * @throws ExceptionFromBitrix |
||
168 | */ |
||
169 | public function delete() |
||
184 | |||
185 | /** |
||
186 | * Save model to database. |
||
187 | * |
||
188 | * @param array $selectedFields save only these fields instead of all. |
||
189 | * @return bool |
||
190 | * @throws ExceptionFromBitrix |
||
191 | */ |
||
192 | public function save($selectedFields = []) |
||
210 | |||
211 | /** |
||
212 | * Determine whether the field should be stopped from passing to "update". |
||
213 | * |
||
214 | * @param string $field |
||
215 | * @param mixed $value |
||
216 | * @param array $selectedFields |
||
217 | * |
||
218 | * @return bool |
||
219 | */ |
||
220 | protected function fieldShouldNotBeSaved($field, $value, $selectedFields) |
||
224 | |||
225 | /** |
||
226 | * Throw bitrix exception on fail |
||
227 | * |
||
228 | * @param \Bitrix\Main\Entity\Result $resultObject |
||
229 | * @throws ExceptionFromBitrix |
||
230 | */ |
||
231 | protected function throwExceptionOnFail($resultObject) |
||
237 | |||
238 | /** |
||
239 | * Set eventErrors field on error. |
||
240 | * |
||
241 | * @param \Bitrix\Main\Entity\Result $resultObject |
||
242 | */ |
||
243 | protected function setEventErrorsOnFail($resultObject) |
||
249 | } |
||
250 |
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.