summaryrefslogtreecommitdiffstats
path: root/library/Icinga/Less/LightModeVisitor.php
blob: 35758b4acbb9d57ba2dcea604489a30fcfb0d4d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
/* Icinga Web 2 | (c) 2022 Icinga GmbH | GPLv2+ */

namespace Icinga\Less;

use Less_VisitorReplacing;

/**
 * Ensure that light mode calls have access to the environment in which the mode was defined
 */
class LightModeVisitor extends Less_VisitorReplacing
{
    use LightModeTrait;

    public $isPreVisitor = true;

    public function visitRulesetCall($c)
    {
        return LightModeCall::fromRulesetCall($c)->setLightMode($this->getLightMode());
    }

    public function run($node)
    {
        return $this->visitObj($node);
    }
}