print or return last error
@param bool $return
@return bool|string
171565
public function error($return = false)
    {
        if (!empty($this->error)) {
            if ($return) {
                return $this->error;
            }
            var_dump($this->error);
            return null;
        }
        return false;
    }
339718
protected function lastJsonErrorMessage($error)
    {
        $errors = [
            JSON_ERROR_DEPTH          => 'Maximum stack depth exceeded',
            JSON_ERROR_STATE_MISMATCH => 'State mismatch (invalid or malformed JSON)',
            JSON_ERROR_CTRL_CHAR      => 'Control character error, possibly incorrectly encoded',
            JSON_ERROR_SYNTAX         => 'Syntax error',
            JSON_ERROR_UTF8           => 'Malformed UTF-8 characters, possibly incorrectly encoded',
        ];

        return isset($errors[$error]) ? $errors[$error] : 'Unknown error';
    }
1005091
static public function lastPregErrorMessage()
    {
        $error = preg_last_error();
        $errorType = 'PCRE Engine error';

        switch ($error) {

            case PREG_BACKTRACK_LIMIT_ERROR:
                $errorType = "PCRE Engine backtrack limit exceeded";
                break;

            case PREG_RECURSION_LIMIT_ERROR:
                $errorType = "PCRE Engine recursion limit exceeded";
                break;

            case PREG_BAD_UTF8_ERROR:case PREG_BAD_UTF8_OFFSET_ERROR:
                $errorType = "PCRE Engine malformed UTF-8 error";
                break;
        }
        
        return $errorType;
    }
727064
public function error($errors = false)
    {
        if ($errors === false) {
            return $this->error;
        } else {
            if (is_array($errors) === true) {
                foreach ($erros as $error) {
                    $this->error($error);
                }
            }
        }
        $this->error[] =(string) $errors;
    }
179781
private function getErrorMessage(array $result)
    {
        $errorMessage = '';
        if (isset($result['errors'][0]['property']) && isset($result['errors'][0]['message'])) {
            $errorMessage = $result['errors'][0]['property'] . ': ' . $result['errors'][0]['message'];
        }
        return $errorMessage;
    }
538460
public function lastError()
	{

		//put this in try...catch block for better error handling
		try{

			//check if there is a valid service instance
			if ( ! $this->validService() ) 
			{
				//throw error
				throw new MySQLException("Not connected to a valid database service");

			}

			//get the error message and return
			return $this->service->error;

		}

		//diplay error message
		catch(MySQLException $MySQLExceptionObject){

			//display error message
			$MySQLExceptionObject->errorShow();

		}

	}
553679
public function getLastError()
    {
        if($this->lastError) {
            return $this->lastError->getMessage();
        }
        $error = $this->pdo->errorInfo();
        if ($error[1]) {
            print_debug($error);
        }
        return $error[2];
    }
1307535
public function last($object = false)
    {
        $this->prepare();

        $data = $this->_map;
        if (count($data) > 0) {
            return $this->prepareResult(end($data), $object);
        }

        return null;
    }
1091648
protected function matchesCondition($return, $exception = null)
    {
        $matched  = false;
        foreach($this->conditions as $expression) {
            if ("isExceptionOf" === $expression["compare"]) {
                $matched = Comparator::isInstanceOf($exception, $expression["value"]);
            } else {
                $matched = Comparator::$expression["compare"]($return, $expression["value"]);
            }
            if ($matched) {
                $matched = $expression["action"];
                break;
            }
        }
        
        return $matched;
    }
991943
static function Configlist_return()
    {
        $old = self::$current;
        self::$current = 0;
        self::$currentend = &self::$current;
        return $old;
    }
516189
public function last(callable $fn = null, $default = null)
    {
        if (is_null($fn)) {
            return count($this->items) > 0 ? end($this->items) : $default;
        }

        foreach (array_reverse($this->items) as $value) {
            if (call_user_func($fn, $value)) {
                return $value;
            }
        }

        return $default;
    }
181075
public function getLastErrorResponse() {
        if (!empty($this->rawResponses)) {
            foreach (array_reverse($this->rawResponses) as $x) {
                if (isset($x['error'])) {
                    return $x;
                }
            }
        }
    }
1336959
private function errorCode()
    {
        if ($this->preparedExec == false){
    		$returnValue = $this->dbConnector->errorCode();
    	}
    	else{
    		$returnValue = $this->lastPreparedExecStatement->errorCode();
    	}
        return (string) $returnValue;
    }
599841
public function displayErrors($htmlOutput = true){

        $returnValue = (string) '';

        foreach($this->errors as $error){
            $returnValue .= $error['message'];
            if(isset($error['file']) && isset($error['line'])){
                $returnValue .= ' in file '.$error['file'].', line '.$error['line'];
            }
            $returnValue .= PHP_EOL;
        }

        if($htmlOutput){
            $returnValue = nl2br($returnValue);
        }

        return (string) $returnValue;
    }
862856
static function get_error_code( $result ) {
            if ( is_object( $result ) &&
                 isset( $result->error ) &&
                 is_object( $result->error ) &&
                 ! empty( $result->error->code )
            ) {
                return $result->error->code;
            }

            return '';
        }
657557
public static function last($str)
    {
        $str = str_replace('\\', '/', $str);
        $i = strrpos($str, '/');
        if ($i === false) {
            return $str;
        }

        return substr($str, ($i + 1));
    }
1348881
protected function getDocBlockReturnType(array $return, array $uses): string
    {
        $return = array_shift($return);
        $type = $return['type'] ?: '';

        $types = [];
        foreach (explode('|', $type) as $tmpType) {
            if (isset($uses[$tmpType])) {
                $tmpType = $uses[$tmpType];
            }
            $types[] = strpos($tmpType, '\\') === 0 ? substr($tmpType, 1) : $tmpType;
        }

        return implode('|', $types);
    }