20 $checkPermissionResult = $this->checkPermission();
21 if (!$checkPermissionResult->isSuccess())
23 $this->
addErrors($checkPermissionResult->getErrors());
29 $checkCaseArgumentsResult = $this->checkArguments($arguments);
30 if (!$checkCaseArgumentsResult->isSuccess())
32 $this->
addErrors($checkCaseArgumentsResult->getErrors());
44 $arguments = $converter->process($arguments);
48 return parent::onBeforeRun();
51 private function checkPermission():
Sale\
Result
57 Sale\Helpers\Rest\AccessChecker::checkAccessPermission();
72 private function checkArguments(array $arguments):
Sale\Result
76 $checkCaseOfKeysResult = $this->checkCaseOfKeys($arguments);
77 if (!$checkCaseOfKeysResult->isSuccess())
79 $result->addErrors($checkCaseOfKeysResult->getErrors());
85 private function checkCaseOfKeys(array $fields):
Sale\Result
87 $result =
new Sale\Result();
91 foreach ($fields as $key => $value)
98 if (mb_strtoupper($key) === $key)
102 "key \"{$key}\" has UPPERCASE notation. Use lowerCamelCase notation",
110 if (\is_array($value))
112 $internalCheckResult = $this->checkCaseOfKeys($value);
113 if (!$internalCheckResult->isSuccess())
115 $result->addErrors($internalCheckResult->getErrors());
125 $result = parent::runWithSourceParametersList();
127 if ($this->errorCollection->isEmpty())
129 if (\is_array($result) && Main\Loader::includeModule(
'rest'))
131 $result = Rest\Integration\Externalizer::multiSortKeysArray($result);
134 return Main\Engine\Response\Converter::toJson()->process($result);
setArguments(array $arguments)