Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Parameter.php
Go to the documentation of this file.
1 <?php
34 {
38  protected $_reflection;
39 
44  protected $_position;
45 
50  protected $_type;
51 
56  protected $_description;
57 
65  public function __construct(ReflectionParameter $r, $type = 'mixed', $description = '')
66  {
67  $this->_reflection = $r;
68  $this->setType($type);
70  }
71 
79  public function __call($method, $args)
80  {
81  if (method_exists($this->_reflection, $method)) {
82  return call_user_func_array(array($this->_reflection, $method), $args);
83  }
84 
85  #require_once 'Zend/Server/Reflection/Exception.php';
86  throw new Zend_Server_Reflection_Exception('Invalid reflection method');
87  }
88 
94  public function getType()
95  {
96  return $this->_type;
97  }
98 
105  public function setType($type)
106  {
107  if (!is_string($type) && (null !== $type)) {
108  #require_once 'Zend/Server/Reflection/Exception.php';
109  throw new Zend_Server_Reflection_Exception('Invalid parameter type');
110  }
111 
112  $this->_type = $type;
113  }
114 
120  public function getDescription()
121  {
122  return $this->_description;
123  }
124 
131  public function setDescription($description)
132  {
133  if (!is_string($description) && (null !== $description)) {
134  #require_once 'Zend/Server/Reflection/Exception.php';
135  throw new Zend_Server_Reflection_Exception('Invalid parameter description');
136  }
137 
138  $this->_description = $description;
139  }
140 
147  public function setPosition($index)
148  {
149  $this->_position = (int) $index;
150  }
151 
157  public function getPosition()
158  {
159  return $this->_position;
160  }
161 }
$type
Definition: item.phtml:13
__construct(ReflectionParameter $r, $type='mixed', $description='')
Definition: Parameter.php:65
$method
Definition: info.phtml:13
$index
Definition: list.phtml:44