/** * @param mixed $offset * @return array|int|null|string */ public function offsetGet($offset) { switch ($offset) { case 'data': return $this->data; case 'line': return $this->line; case 'version': return $this->version; case 'reason': return $this->reasonId; case 'reasonName': return Reason::getReasonNameFromValue($this->reasonId); case 'raw_msg': if ($this->msg !== null) { return $this->msg; } return $this->getResult()->getMsgFormatter()->getLocator()->getMessage($this->reasonId); case 'targetId': return $this->getResult()->getAnalysisTargetId(); case 'msg': if ($this->msg !== null) { return $this->msg; } return $this->getResult()->getMsgFormatter()->getFormattedMessageFromId($this->reasonId, array_merge($this->data, [MessageFormatter::FORMAT_KEY_LINE => $this->line, MessageFormatter::FORMAT_KEY_REASON_ID => $this->reasonId, MessageFormatter::FORMAT_KEY_TARGET_ID => $this->getResult()->getAnalysisTargetId(), MessageFormatter::FORMAT_KEY_VERSION => $this->version, MessageFormatter::FORMAT_KEY_REASON_NAME => $this->offsetGet('reasonName')])); } return null; }