public function getMessageByCode( $code, array $data = NULL, $customMessage = NULL )
	{
		// Use custom message when set.
		if ( !empty($customMessage) && \strlen($customMessage) > 0 )
		{
			return \vsprintf($customMessage, $data );
		}

		// When no entry for code found, return a generic error message.
		if ( !\array_key_exists($code, $this->messages) )
		{
			return $this->messages[ self::GENERIC ];
		}

		// Parse variables in the error message when present.
		if ( \is_array($data) )
		{
			return \vsprintf( $this->messages[$code], $data );
		}

		return $this->messages[ $code ];
	}