diff options
Diffstat (limited to 'vendor/scssphp/scssphp/src/Value/SassFunction.php')
-rw-r--r-- | vendor/scssphp/scssphp/src/Value/SassFunction.php | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/vendor/scssphp/scssphp/src/Value/SassFunction.php b/vendor/scssphp/scssphp/src/Value/SassFunction.php new file mode 100644 index 000000000..54f945b38 --- /dev/null +++ b/vendor/scssphp/scssphp/src/Value/SassFunction.php @@ -0,0 +1,59 @@ +<?php + +/** + * SCSSPHP + * + * @copyright 2012-2020 Leaf Corcoran + * + * @license http://opensource.org/licenses/MIT MIT + * + * @link http://scssphp.github.io/scssphp + */ + +namespace ScssPhp\ScssPhp\Value; + +use ScssPhp\ScssPhp\SassCallable\SassCallable; +use ScssPhp\ScssPhp\Util\EquatableUtil; +use ScssPhp\ScssPhp\Visitor\ValueVisitor; + +/** + * A SassScript function reference. + * + * A function reference captures a function from the local environment so that + * it may be passed between modules. + */ +final class SassFunction extends Value +{ + private readonly SassCallable $callable; + + /** + * @internal + */ + public function __construct(SassCallable $callable) + { + $this->callable = $callable; + } + + /** + * @internal + */ + public function getCallable(): SassCallable + { + return $this->callable; + } + + public function accept(ValueVisitor $visitor) + { + return $visitor->visitFunction($this); + } + + public function assertFunction(?string $name = null): SassFunction + { + return $this; + } + + public function equals(object $other): bool + { + return $other instanceof SassFunction && EquatableUtil::equals($this->callable, $other->callable); + } +} |