16 private $interchangeableParams = [];
20 $this->params = $this->changeKeyCaseRecursive($params);
22 $this->interchangeableParams = [
23 "IBLOCK_ID" =>
"IBLOCK_CODE",
24 "IBLOCK_CODE" =>
"IBLOCK_ID",
25 "ELEMENT_ID" =>
"ELEMENT_CODE",
26 "ELEMENT_CODE" =>
"ELEMENT_ID",
27 "SECTION_ID" =>
"SECTION_CODE",
28 "SECTION_CODE" =>
"SECTION_ID"
41 foreach ($requiredInputParams as $param)
45 $this->checkArrayParam($param);
49 $this->checkParam($param);
61 $params = $this->changeKeyCaseRecursive($params);
62 $this->params = array_merge($this->params, $params);
75 private function changeKeyCaseRecursive(array $params)
77 return array_map(
function($item) {
80 $item = $this->changeKeyCaseRecursive($item);
83 }, array_change_key_case($params, CASE_UPPER));
86 private function checkArrayParam(array $param)
88 foreach ($param as $innerParam => $listParam)
90 if (is_array($listParam))
92 foreach ($listParam as $listInnerParam)
94 if (!isset($this->params[$innerParam][$listInnerParam]))
97 !isset($this->interchangeableParams[$listInnerParam]) ||
98 !isset($this->params[$this->interchangeableParams[$listInnerParam]])
101 $this->setParamError($listInnerParam);
109 private function checkParam($param)
111 if (!isset($this->params[$param]))
114 !isset($this->interchangeableParams[$param]) ||
115 !isset($this->params[$this->interchangeableParams[$param]])
118 $this->setParamError($param);
123 private function setParamError($param)
125 $this->errorCollection->setError(
127 "Required parameter \"".$param.
"\" is missing", self::ERROR_REQUIRED_PARAMETERS_MISSING
trait ErrorableImplementation