Returns a referenced error

@param type $i
@param type $toString
@return type
553724
final public function getError($i = null, $toString = true)
    {

        // Find the error
        if ($i === null) {
            // Default, return the last message
            $error = end(self::$errors);
        } else
            if (!array_key_exists($i, self::$errors)) {
                // If $i has been specified but does not exist, return false
                return false;
            } else {
                $error = self::$errors[$i];
            }

        return $error;
    }
776097
public function getError()
    {
        if($this->isError() || $this->isDeclined())
        {
            return new PaynetException($this->getErrorMessage(), $this->getErrorCode());
        }
        else
        {
            throw new RuntimeException('Response has no error');
        }
    }
1168449
public static function fromString(string $propertyString): self
    {
        $propertyData = @parse_ini_string($propertyString, true);
        if (false === $propertyData) {
            throw new \InvalidArgumentException(
                    'Property string contains errors and can not be parsed: '
                    . lastErrorMessage()->value()
            );
        }

        return new static($propertyData);
    }
484206
protected function getCorrectType($string)
    {
        if (!is_string($string)) {
            return $string;
        }

        switch (strtolower($string)) {
            case 'true':
                return true;
            case 'false':
                return false;
            case 'null':
                return null;
        }

        if (is_numeric($string)) {
            return (int)$string;
        }

        return $string;
    }
550887
public function getError($intDynamicPosition = 0)
    {
        $strReturn = "";

        if (isset($this->__errors[$intDynamicPosition]) && !empty($this->__errors[$intDynamicPosition])) {
            $strReturn = $this->__errors[$intDynamicPosition];
        }

        return $strReturn;
    }
413663
def _xmlTextReaderErrorFunc(xxx_todo_changeme,msg,severity,locator):
    """"""
    (f,arg) = xxx_todo_changeme
    return f(arg,msg,severity,xmlTextReaderLocator(locator))
162074
public function getErrorOnInstanceCode($instanceName) {
		if (isset($this->declaredInstances[$instanceName]["error"])) {
			return $this->declaredInstances[$instanceName]["error"];
		}
		return null;
	}
1275078
public static function get_errors($index = null)
	{
		// convert element name formats
		is_string($index) and $index = str_replace(':', '.', $index);

		$files = static::$upload->getInvalidFiles($index);

		// convert the file object to 1.x compatible data
		$result = array();

		foreach ($files as $file)
		{
			$data = array();
			foreach ($file as $item => $value)
			{
				// swap item names for BC
				$item == 'element' and $item = 'field';
				$item == 'tmp_name' and $item = 'file';
				$item == 'filename' and $item = 'saved_as';
				$item == 'path' and $item = 'saved_to';
				$data[$item] = $value;
			}
			$data['field'] = str_replace('.', ':', $data['field']);
			$data['error'] = ! $file->isValid();
			$data['errors'] = array();
			foreach ($file->getErrors() as $error)
			{
				$data['errors'][] = array('error' => $error->getError(), 'message' => $error->getMessage());
			}
			$result[] = $data;
		}

		// compatibility with < 1.5, return the single entry if only one was found
		if (func_num_args() and count($result) == 1)
		{
			return reset($result);
		}
		else
		{
			return $result;
		}
	}
593756
public static function charAt(string $str, int $i): string
    {
        return (string)BaseStringy::create($str)->at($i);
    }
558054
public function getFirstError()
    {
        if (empty($this->errorMessages)) {
            return '';
        }

        reset($this->errorMessages);
        return current(current($this->errorMessages));
    }
161781
static function getUploadError($iErrorNumber)
    {
        //  Upload was aborted, I wonder why?
        switch ($iErrorNumber) {

            case UPLOAD_ERR_INI_SIZE:

                $iMaxFileSize = function_exists('ini_get') ? ini_get('upload_max_filesize') : null;

                if (!is_null($iMaxFileSize)) {

                    $iMaxFileSize = static::returnBytes($iMaxFileSize);
                    $iMaxFileSize = static::formatBytes($iMaxFileSize);
                    $sError       = sprintf(
                        'The file exceeds the maximum size accepted by this server (which is %s).',
                        $iMaxFileSize
                    );

                } else {
                    $sError = 'The file exceeds the maximum size accepted by this server.';
                }
                break;

            case UPLOAD_ERR_FORM_SIZE:
                $sError = 'The file exceeds the maximum size accepted by this server.';
                break;

            case UPLOAD_ERR_PARTIAL:
                $sError = 'The file was only partially uploaded.';
                break;

            case UPLOAD_ERR_NO_FILE:
                $sError = 'No file was uploaded.';
                break;

            case UPLOAD_ERR_NO_TMP_DIR:
                $sError = 'This server cannot accept uploads at this time.';
                break;

            case UPLOAD_ERR_CANT_WRITE:
                $sError = 'Failed to write uploaded file to disk, you can try again.';
                break;

            case UPLOAD_ERR_EXTENSION:
                $sError = 'The file failed to upload due to a server configuration.';
                break;

            default:
                $sError = 'The file failed to upload.';
                break;
        }

        return $sError;
    }
98877
protected function internalError(Exception $e)
    {
        if (isset($this->hooks['internal.error'])) {
            return $this->hooks['internal.error']($e);
        } else {
            return (new Response())
                ->setStatusCode(500)
                ->setBody('Internal error: ' . $e->getMessage());
        }
    }
747098
public function getErrorMessage()
    {
        if ($this->returnLetter instanceof ReturnLetter
                && $this->returnLetter->errorID !== 0) {
            return $this->returnLetter->error;
        }
    }
575680
static public function conversionFailedInvalidType($value, $toType, array $possibleTypes)
    {
        $actualType = is_object($value) ? get_class($value) : gettype($value);

        if (is_scalar($value)) {
            return new self(sprintf(
                "Could not convert PHP value '%s' of type '%s' to type '%s'. Expected one of the following types: %s",
                $value,
                $actualType,
                $toType,
                implode(', ', $possibleTypes)
            ));
        }

        return new self(sprintf(
            "Could not convert PHP value of type '%s' to type '%s'. Expected one of the following types: %s",
            $actualType,
            $toType,
            implode(', ', $possibleTypes)
        ));
    }
857081
public static function getTypeError( $type ) {

		$data = [
			Type::TEXT      => static::TEXT,
			Type::INTEGER   => static::INTEGER,
			Type::FLOAT     => static::FLOAT,
			Type::BOOLEAN   => static::BOOLEAN,
			Type::TIMESTAMP => static::TIMESTAMP,
			Type::DATETIME  => static::DATETIME,
			Type::DATE      => static::DATE,
			Type::TIME      => static::TIME,
			Type::YEAR      => static::YEAR,
			Type::IP        => static::IP,
			Type::EMAIL     => static::EMAIL,
			Type::URL       => static::URL,
			Type::JSON      => static::JSON,
			Type::OBJECT    => static::VALUE,
			Type::ENTITY    => static::VALUE,
		];

		return isset($data[$type]) ? $data[$type] : static::VALUE;

	}
1336563
function ErrorMsg()
	{
		if (!$this->_connectionID) return "No connection established";
		$errmsg = '';

		try {
			$errc = $this->_connectionID->Errors;
			if (!$errc) return "No Errors object found";
			if ($errc->Count == 0) return '';
			$err = $errc->Item($errc->Count-1);
			$errmsg = $err->Description;
		}catch(exception $e) {
		}
		return $errmsg;
	}
176074
private function getErrorLinksRepresentation(ErrorInterface $error): ?array
    {
        $linksRepresentation = null;

        if (($value = $error->getLinks()) !== null) {
            $linksRepresentation = $this->getLinksRepresentation($this->getUrlPrefix(), $value);
        }

        if (($value = $error->getTypeLinks()) !== null) {
            $linksRepresentation[DocumentInterface::KEYWORD_ERRORS_TYPE] =
                $this->getLinksListRepresentation($this->getUrlPrefix(), $value);
        }

        return $linksRepresentation;
    }