$lastError = error_get_last();
@param array $lastError
@param null|string $catcher
@return array
321275
public static function toArray(array $lastError, $catcher = null)
    {
        $digest = 'Fatal Error (' . self::codeToString($lastError['type']) . '): ' . $lastError['message'];
        $data = [
            'code' => $lastError['type'],
            'message' => $lastError['message'],
            'file' => $lastError['file'],
            'line' => $lastError['line'],
            'catcher' => __METHOD__,
        ];

        if ($catcher) {
            $data['catcher'] = $catcher;
        }

        return [$digest, $data];
    }
984532
private function getError() {
        if (!curl_errno($this->curl)) return array();
        return array('error_no' => curl_errno($this->curl), 'error' => curl_error($this->curl));
    }
530420
public static function getLastRow(array $array)
    {
        /*
         * No elements?
         * Nothing to do
         */
        if (empty($array)) {
            return null;
        }

        $effect = [];
        $last = end($array);

        if (is_array($last)) {
            // We've got an array, so looking for the last row of array will be done recursively
            $effect = self::getLastRow($last);

            /*
             * The last row is not an array or it's an empty array?
             * Let's use the previous candidate
             */
            if (!is_array($effect) || (is_array($effect) && empty($effect))) {
                $effect = $last;
            }
        }

        return $effect;
    }
916184
private static function catchError()
    {
        switch (json_last_error()) {
            case JSON_ERROR_NONE:
                self::$error = false;
                break;
            case JSON_ERROR_DEPTH:
                self::$error = 'Maximum stack depth exceeded';
                break;
            case JSON_ERROR_STATE_MISMATCH:
                self::$error = 'Underflow or the modes mismatch';
                break;
            case JSON_ERROR_CTRL_CHAR:
                self::$error = 'Unexpected control character found';
                break;
            case JSON_ERROR_SYNTAX:
                self::$error = 'Syntax error, malformed JSON';
                break;
            case JSON_ERROR_UTF8:
                self::$error = 'Malformed UTF-8 characters, possibly incorrectly encoded';
                break;
            default:
                self::$error = 'Unknown error';
                break;
        }
    }
1199246
public function last(callable $conditions = null)
    {
        $array = $this->convertArray($this);

        if ($conditions) {
            $prev = null;

            foreach ($array as $key => $value) {
                if ($conditions($value, $key)) {
                    $prev = $value;
                }
            }

            return $prev;
        }

        return $array[array_key_last($array)];
    }
706599
public static function formatError(Error $exception)
    {
        $error = [
            'message' => $exception->getMessage(),
        ];

        $locations = $exception->getLocations();
        if (!empty($locations)) {
            $error['locations'] = array_map(function (SourceLocation $loc) {
                return $loc->toArray();
            }, $locations);
        }

        $previous = $exception->getPrevious();
        if ($previous && $previous instanceof ValidationException) {
            $error['validation'] = $previous->getResult()->getMessages();
        }

        return $error;
    }
682604
public function getLastChange($object)
    {
        $lastChange = null;
        $allChanges = $this->getAllChanges($object);
        if (count($allChanges)) {
            $lastChange = end($allChanges);
        }
        return $lastChange;
    }
526991
public static function lastErrorMsg()
    {
        if (is_string(self::$error)) {
            return self::$error;
        }

        switch (self::$error) {
            case 0:
                $msg = 'No Error';
                break;

            case self::EXISTS:
                $msg = 'The target path "' . self::$target . '" already exists';
                break;

            case self::IS_LINK:
                $msg = 'The target path "' . self::$target . '" is a symbolic link';
                break;

            case self::NOT_FOUND:
                $msg = 'The target path "' . self::$target . '" does not appear to exist';
                break;

            case self::NOT_DIRECTORY:
                $msg = 'The target path "' . self::$target . '" does not appear to be a folder';
                break;

            case self::NOT_GRAV_ROOT:
                $msg = 'The target path "' . self::$target . '" does not appear to be a Grav instance';
                break;

            case self::ZIP_OPEN_ERROR:
                $msg = 'Unable to open the package file';
                break;

            case self::ZIP_EXTRACT_ERROR:
                $msg = 'Unable to extract the package. ';
                if (self::$error_zip) {
                    switch(self::$error_zip) {
                        case \ZipArchive::ER_EXISTS:
                            $msg .= 'File already exists.';
                            break;

                        case \ZipArchive::ER_INCONS:
                            $msg .= 'Zip archive inconsistent.';
                            break;

                        case \ZipArchive::ER_MEMORY:
                            $msg .= 'Memory allocation failure.';
                            break;

                        case \ZipArchive::ER_NOENT:
                            $msg .= 'No such file.';
                            break;

                        case \ZipArchive::ER_NOZIP:
                            $msg .= 'Not a zip archive.';
                            break;

                        case \ZipArchive::ER_OPEN:
                            $msg .= "Can't open file.";
                            break;

                        case \ZipArchive::ER_READ:
                            $msg .= 'Read error.';
                            break;

                        case \ZipArchive::ER_SEEK:
                            $msg .= 'Seek error.';
                            break;
                    }
                }
                break;

            case self::INVALID_SOURCE:
                $msg = 'Invalid source file';
                break;

            default:
                $msg = 'Unknown Error';
                break;
        }

        return $msg;
    }
1311952
private static function getLastJsonError()
    {
        if (function_exists('json_last_error_msg')) {
            return json_last_error_msg();
        }
        static $errors = array(
            JSON_ERROR_NONE           => null,
            JSON_ERROR_DEPTH          => 'Maximum stack depth exceeded',
            JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch',
            JSON_ERROR_CTRL_CHAR      => 'Unexpected control character found',
            JSON_ERROR_SYNTAX         => 'Syntax error, malformed JSON',
            JSON_ERROR_UTF8           => 'Malformed UTF-8 characters, possibly incorrectly encoded',
        );
        $error = json_last_error();

        return array_key_exists($error, $errors)
            ? $errors[$error]
            : sprintf('Unknown error (%s)', $error);
    }
468409
public static function check()
    {
        $collections = self::getCollection();

        $jsonLastError = json_last_error();

        return isset($jsonLastError) ? $collections[$jsonLastError] : $collections['default'];
    }
612972
public static function lastErrorMsg($file,$message,$data) {
		Console::writeLine(PHP_EOL."<error>The JSON file, ".$file.", wasn't loaded. The error: ".$message."</error>");
		if ($message == "Syntax error, malformed JSON") {
			Console::writeLine("");
			$parser = new JsonLint\JsonParser();
			$error  = $parser->lint($data);
			Console::writeError($error->getMessage(), false, true);
		}
	}
150049
public function lastIndexOf($value) {
        $array = [];
        foreach ($this->array as $key => $val) {
            if (null === $val) {
                continue;
            }
            if (Comparator::equals($val, $value)) {
                $array[] = $key;
            }
        }
        return \count($array) === 0 ? null : $array;
    }
379304
public function last()
    {
        $arr = $this->val();
        $last = end($arr);

        return StdObjectWrapper::returnStdObject($last);
    }
539045
public function getError()
    {
        for ($i = 0, $c = count($this->read); $i < $c; $i++) {
            if (!$this->read[$i]) continue;
            $this->error[] = socket_last_error($this->read[$i]['sock']);
        }
    }
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';
    }
201855
function captureLastError()
    {
        if (null === $error = error_get_last()) {
            return;
        }

        $e = new \ErrorException(
            @$error['message'], 0, @$error['type'],
            @$error['file'], @$error['line']
        );

        return $this->captureException($e);
    }
765154
private function getLastXMLErrorMessage()
    {
        $errorMessage = null;
        $error = libxml_get_last_error();

        if ($error !== false) {
            $errorMessage = trim($error->message);
        }

        return $errorMessage;
    }