Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Request.php
Go to the documentation of this file.
1 <?php
7 
14 {
25  public function __call($method, $args)
26  {
27  $key = $this->_underscore(substr($method, 3));
28  if (isset($args[0]) && (strstr($args[0], '=') || strstr($args[0], '&'))) {
29  $key .= '[' . strlen($args[0]) . ']';
30  }
31  switch (substr($method, 0, 3)) {
32  case 'get':
33  //\Magento\Framework\Profiler::start('GETTER: '.get_class($this).'::'.$method);
34  $data = $this->getData($key, isset($args[0]) ? $args[0] : null);
35  //\Magento\Framework\Profiler::stop('GETTER: '.get_class($this).'::'.$method);
36  return $data;
37 
38  case 'set':
39  //\Magento\Framework\Profiler::start('SETTER: '.get_class($this).'::'.$method);
40  $result = $this->setData($key, isset($args[0]) ? $args[0] : null);
41  //\Magento\Framework\Profiler::stop('SETTER: '.get_class($this).'::'.$method);
42  return $result;
43 
44  case 'uns':
45  //\Magento\Framework\Profiler::start('UNS: '.get_class($this).'::'.$method);
46  $result = $this->unsetData($key);
47  //\Magento\Framework\Profiler::stop('UNS: '.get_class($this).'::'.$method);
48  return $result;
49 
50  case 'has':
51  //\Magento\Framework\Profiler::start('HAS: '.get_class($this).'::'.$method);
52  //\Magento\Framework\Profiler::stop('HAS: '.get_class($this).'::'.$method);
53  return isset($this->_data[$key]);
54  }
55  throw new \Magento\Framework\Exception\LocalizedException(
56  __("Invalid method %1::%2", get_class($this), $method)
57  );
58  }
59 }
getData($key='', $index=null)
Definition: DataObject.php:119
__()
Definition: __.php:13
$method
Definition: info.phtml:13
setData($key, $value=null)
Definition: DataObject.php:72