errorInfo = $errorInfo; if (!empty($errorInfo)) { $properties = ['name', 'message', 'code', 'data']; foreach ($properties as $property) { if (isset($errorInfo[$property])) { $this->{$property} = $errorInfo[$property]; } } } } /** * @return array */ public function getErrorInfo() { return $this->errorInfo; } }