Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
OperationDefinitionBuilder.php
Go to the documentation of this file.
1 <?php
6 namespace tests\unit\Util;
7 
9 
11 {
17  private $name;
18 
24  private $operation;
25 
31  private $type;
32 
38  private $metadata = [];
39 
44  private $removeBackend;
45 
51  public function build()
52  {
53  return new OperationDefinitionObject(
54  $this->name,
55  $this->operation,
56  $this->type,
57  null,
58  null,
59  null,
60  null,
61  null,
62  $this->metadata,
63  null,
64  false
65  );
66  }
67 
74  public function withName($name)
75  {
76  $this->name = $name;
77  return $this;
78  }
79 
86  public function withOperation($operation)
87  {
88  $this->operation = $operation;
89  return $this;
90  }
91 
98  public function withType($type)
99  {
100  $this->type = $type;
101  return $this;
102  }
103 
110  public function withMetadata($metadata)
111  {
112  $primitives = [];
113  foreach ($metadata as $fieldName => $value) {
114  // type check here TODO
115  if (is_string($value)) {
116  $primitives[$fieldName] = $value;
117  } else {
118  $this->metadata[] = $value;
119  }
120  }
121 
122  $this->metadata = array_merge(
123  $this->metadata,
125  );
126  return $this;
127  }
128 }
$value
Definition: gender.phtml:16