Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
/**
4
 * SCSSPHP
5
 *
6
 * @copyright 2012-2020 Leaf Corcoran
7
 *
8
 * @license http://opensource.org/licenses/MIT MIT
9
 *
10
 * @link http://scssphp.github.io/scssphp
11
 */
12
 
13
namespace ScssPhp\ScssPhp;
14
 
15
final class OutputStyle
16
{
17
    const EXPANDED = 'expanded';
18
    const COMPRESSED = 'compressed';
19
 
20
    /**
21
     * Converts a string to an output style.
22
     *
23
     * Using this method allows to write code which will support both
24
     * versions 1.12+ and 2.0 of Scssphp. In 2.0, OutputStyle will be
25
     * an enum instead of using string constants.
26
     *
27
     * @param string $string
28
     *
29
     * @return self::*
30
     */
31
    public static function fromString($string)
32
    {
33
        switch ($string) {
34
            case 'expanded':
35
                return self::EXPANDED;
36
 
37
            case 'compressed':
38
                return self::COMPRESSED;
39
 
40
            default:
41
                throw new \InvalidArgumentException('Invalid output style');
42
        }
43
    }
44
 
45
    /**
46
     * Converts an output style to a string supported by {@see OutputStyle::fromString()}.
47
     *
48
     * Using this method allows to write code which will support both
49
     * versions 1.12+ and 2.0 of Scssphp. In 2.0, OutputStyle will be
50
     * an enum instead of using string constants.
51
     * The returned string representation is guaranteed to be compatible
52
     * between 1.12 and 2.0.
53
     *
54
     * @param self::* $outputStyle
55
     *
56
     * @return string
57
     */
58
    public static function toString($outputStyle)
59
    {
60
        return $outputStyle;
61
    }
62
}