1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * Copyright (c) 2017-2020 Andreas Möller
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE.md file that was distributed with this source code.
10
 *
11
 * @see https://github.com/ergebnis/classy
12
 */
13

14
namespace Ergebnis\Classy\Exception;
15

16
final class ParseError extends \ParseError implements ExceptionInterface
17
{
18 1
    public static function fromParseError(\ParseError $exception): self
19
    {
20 1
        return new self(
21 1
            $exception->getMessage(),
22 1
            0,
23
            $exception
24
        );
25
    }
26

27 1
    public static function fromFileNameAndParseError(string $fileName, \ParseError $exception): self
28
    {
29 1
        return new self(
30 1
            \sprintf(
31 1
                'A parse error occurred when parsing "%s": "%s".',
32 1
                $fileName,
33 1
                $exception->getMessage()
34
            ),
35 1
            0,
36
            $exception
37
        );
38
    }
39
}

Read our documentation on viewing source code .

Loading