Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Operator.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
11 
17 class Operator
18 {
23 
27  const OR = 'or';
28 
32  const AND = 'and';
33 
37  private $value;
38 
43  public function __construct(string $value = null)
44  {
45  if (!$value) {
46  $value = self::AND;
47  }
48  $type = new \ReflectionClass($this);
49  if (!in_array($value, $type->getConstants())) {
50  throw new \Magento\Framework\GraphQl\Exception\GraphQlInputException(
51  new Phrase('%1 operator not supported', [$value])
52  );
53  }
54  $this->value = $value;
55  }
56 
62  public static function getOperators() : array
63  {
64  $type = new \ReflectionClass(Operator::class);
65  return $type->getConstants();
66  }
67 
73  public function __toString() : string
74  {
75  return strtoupper($this->value);
76  }
77 }
$block setTitle( 'CMS Block Title') -> setIdentifier('fixture_block') ->setContent('< h1 >Fixture Block Title</h1 >< a href=" store url</a><p> Config value
Definition: block.php:9
$type
Definition: item.phtml:13