/** * validate parameters * @param array<String> $param * @return array<String> */ protected function validateParameters($param) { if (!isset($param['name']) || empty($param['name'])) { throw new SystemException('a Parameter name cannot be empty'); } if (isset($param['regex']) && !empty($param['regex'])) { $regex = new Regex($param['regex']); if (!$regex->isValid()) { throw new SystemException('the regex of "' . $param['name'] . '" is invalid'); } } else { $param['regex'] = ''; } if (isset($param['type'])) { $param['type'] = strtoupper($param['type']); if (!in_array($param['type'], $this->allowedTypes)) { throw new SystemException('the type for "' . $param['name'] . '" is invalid'); } } else { throw new SystemException('the type for "' . $param['name'] . '" is invalid'); } return $param; }