PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev1
Elementor Website Builder – more than just a page builder v3.28.0-dev1
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / vendor_prefixed / twig / src / TwigTest.php

TwigTest.php in Elementor Website Builder – more than just a page builder 3.28.0-dev1, at vendor_prefixed/twig/src/TwigTest.php

86 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of Twig.
5 *
6 * (c) Fabien Potencier
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 namespace ElementorDeps\Twig;
12
13 use ElementorDeps\Twig\Node\Expression\TestExpression;
14 /**
15 * Represents a template test.
16 *
17 * @author Fabien Potencier <fabien@symfony.com>
18 *
19 * @see https://twig.symfony.com/doc/templates.html#test-operator
20 */
21 final class TwigTest
22 {
23 private $name;
24 private $callable;
25 private $options;
26 private $arguments = [];
27 /**
28 * @param callable|array{class-string, string}|null $callable A callable implementing the test. If null, you need to overwrite the "node_class" option to customize compilation.
29 */
30 public function __construct(string $name, $callable = null, array $options = [])
31 {
32 $this->name = $name;
33 $this->callable = $callable;
34 $this->options = \array_merge(['is_variadic' => \false, 'node_class' => TestExpression::class, 'deprecated' => \false, 'deprecating_package' => '', 'alternative' => null, 'one_mandatory_argument' => \false], $options);
35 }
36 public function getName() : string
37 {
38 return $this->name;
39 }
40 /**
41 * Returns the callable to execute for this test.
42 *
43 * @return callable|array{class-string, string}|null
44 */
45 public function getCallable()
46 {
47 return $this->callable;
48 }
49 public function getNodeClass() : string
50 {
51 return $this->options['node_class'];
52 }
53 public function setArguments(array $arguments) : void
54 {
55 $this->arguments = $arguments;
56 }
57 public function getArguments() : array
58 {
59 return $this->arguments;
60 }
61 public function isVariadic() : bool
62 {
63 return (bool) $this->options['is_variadic'];
64 }
65 public function isDeprecated() : bool
66 {
67 return (bool) $this->options['deprecated'];
68 }
69 public function getDeprecatingPackage() : string
70 {
71 return $this->options['deprecating_package'];
72 }
73 public function getDeprecatedVersion() : string
74 {
75 return \is_bool($this->options['deprecated']) ? '' : $this->options['deprecated'];
76 }
77 public function getAlternative() : ?string
78 {
79 return $this->options['alternative'];
80 }
81 public function hasOneMandatoryArgument() : bool
82 {
83 return (bool) $this->options['one_mandatory_argument'];
84 }
85 }
86