Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Data Fields
Operator Class Reference

Public Member Functions

 __construct (string $value=null)
 
 __toString ()
 

Static Public Member Functions

static getOperators ()
 

Data Fields

const __DEFAULT = self::AND
 
const OR = 'or'
 
const AND = 'and'
 

Detailed Description

Operator is the part in the find argument that does logic branching.

Example: {"and": { "or": {} } }

Definition at line 17 of file Operator.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( string  $value = null)
Parameters
string | null$value
Exceptions

Definition at line 43 of file Operator.php.

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  }
$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

Member Function Documentation

◆ __toString()

__toString ( )

Convert operator to string

Returns
string

Definition at line 73 of file Operator.php.

73  : string
74  {
75  return strtoupper($this->value);
76  }
$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

◆ getOperators()

static getOperators ( )
static

Get the operators defined by this class as constants

Returns
array

Definition at line 62 of file Operator.php.

62  : array
63  {
64  $type = new \ReflectionClass(Operator::class);
65  return $type->getConstants();
66  }
$type
Definition: item.phtml:13

Field Documentation

◆ __DEFAULT

const __DEFAULT = self::AND

Default Operator

Definition at line 22 of file Operator.php.

◆ AND

const AND = 'and'

AND operator

Definition at line 32 of file Operator.php.

◆ OR

const OR = 'or'

OR operator

Definition at line 27 of file Operator.php.


The documentation for this class was generated from the following file: