Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Definition.php
Go to the documentation of this file.
1 <?php
33 {
37  protected $_callback;
38 
42  protected $_invokeArguments = array();
43 
47  protected $_methodHelp = '';
48 
52  protected $_name;
53 
57  protected $_object;
58 
62  protected $_prototypes = array();
63 
70  public function __construct($options = null)
71  {
72  if ((null !== $options) && is_array($options)) {
73  $this->setOptions($options);
74  }
75  }
76 
83  public function setOptions(array $options)
84  {
85  foreach ($options as $key => $value) {
86  $method = 'set' . ucfirst($key);
87  if (method_exists($this, $method)) {
88  $this->$method($value);
89  }
90  }
91  return $this;
92  }
93 
100  public function setName($name)
101  {
102  $this->_name = (string) $name;
103  return $this;
104  }
105 
111  public function getName()
112  {
113  return $this->_name;
114  }
115 
122  public function setCallback($callback)
123  {
124  if (is_array($callback)) {
125  #require_once 'Zend/Server/Method/Callback.php';
126  $callback = new Zend_Server_Method_Callback($callback);
127  } elseif (!$callback instanceof Zend_Server_Method_Callback) {
128  #require_once 'Zend/Server/Exception.php';
129  throw new Zend_Server_Exception('Invalid method callback provided');
130  }
131  $this->_callback = $callback;
132  return $this;
133  }
134 
140  public function getCallback()
141  {
142  return $this->_callback;
143  }
144 
151  public function addPrototype($prototype)
152  {
153  if (is_array($prototype)) {
154  #require_once 'Zend/Server/Method/Prototype.php';
155  $prototype = new Zend_Server_Method_Prototype($prototype);
156  } elseif (!$prototype instanceof Zend_Server_Method_Prototype) {
157  #require_once 'Zend/Server/Exception.php';
158  throw new Zend_Server_Exception('Invalid method prototype provided');
159  }
160  $this->_prototypes[] = $prototype;
161  return $this;
162  }
163 
170  public function addPrototypes(array $prototypes)
171  {
172  foreach ($prototypes as $prototype) {
173  $this->addPrototype($prototype);
174  }
175  return $this;
176  }
177 
184  public function setPrototypes(array $prototypes)
185  {
186  $this->_prototypes = array();
187  $this->addPrototypes($prototypes);
188  return $this;
189  }
190 
196  public function getPrototypes()
197  {
198  return $this->_prototypes;
199  }
200 
207  public function setMethodHelp($methodHelp)
208  {
209  $this->_methodHelp = (string) $methodHelp;
210  return $this;
211  }
212 
218  public function getMethodHelp()
219  {
220  return $this->_methodHelp;
221  }
222 
229  public function setObject($object)
230  {
231  if (!is_object($object) && (null !== $object)) {
232  #require_once 'Zend/Server/Exception.php';
233  throw new Zend_Server_Exception('Invalid object passed to ' . __CLASS__ . '::' . __METHOD__);
234  }
235  $this->_object = $object;
236  return $this;
237  }
238 
244  public function getObject()
245  {
246  return $this->_object;
247  }
248 
255  public function setInvokeArguments(array $invokeArguments)
256  {
257  $this->_invokeArguments = $invokeArguments;
258  return $this;
259  }
260 
266  public function getInvokeArguments()
267  {
269  }
270 
276  public function toArray()
277  {
278  $prototypes = $this->getPrototypes();
279  $signatures = array();
280  foreach ($prototypes as $prototype) {
281  $signatures[] = $prototype->toArray();
282  }
283 
284  return array(
285  'name' => $this->getName(),
286  'callback' => $this->getCallback()->toArray(),
287  'prototypes' => $signatures,
288  'methodHelp' => $this->getMethodHelp(),
289  'invokeArguments' => $this->getInvokeArguments(),
290  'object' => $this->getObject(),
291  );
292  }
293 }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
addPrototypes(array $prototypes)
Definition: Definition.php:170
setInvokeArguments(array $invokeArguments)
Definition: Definition.php:255
$value
Definition: gender.phtml:16
setOptions(array $options)
Definition: Definition.php:83
$method
Definition: info.phtml:13
setPrototypes(array $prototypes)
Definition: Definition.php:184
if(!isset($_GET['name'])) $name
Definition: log.php:14