Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
namespace ScssPhp\ScssPhp\Exception;
4
 
5
/**
6
 * An exception thrown by SassScript.
7
 *
8
 * This class does not implement SassException on purpose, as it should
9
 * never be returned to the outside code. The compilation will catch it
10
 * and replace it with a SassException reporting the location of the
11
 * error.
12
 */
13
class SassScriptException extends \Exception
14
{
15
    /**
16
     * Creates a SassScriptException with support for an argument name.
17
     *
18
     * This helper ensures a consistent handling of argument names in the
19
     * error message, without duplicating it.
20
     *
21
     * @param string      $message
22
     * @param string|null $name    The argument name, without $
23
     *
24
     * @return SassScriptException
25
     */
26
    public static function forArgument($message, $name = null)
27
    {
28
        $varDisplay = !\is_null($name) ? "\${$name}: " : '';
29
 
30
        return new self($varDisplay . $message);
31
    }
32
}