Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
Zend_Server_Abstract Class Reference
Inheritance diagram for Zend_Server_Abstract:
Zend_Server_Interface Zend_Json_Server

Public Member Functions

 __construct ()
 
 getFunctions ()
 
- Public Member Functions inherited from Zend_Server_Interface
 addFunction ($function, $namespace='')
 
 setClass ($class, $namespace='', $argv=null)
 
 fault ($fault=null, $code=404)
 
 handle ($request=false)
 
 loadFunctions ($definition)
 
 setPersistence ($mode)
 

Static Public Member Functions

static lowerCase (&$value, &$key)
 

Protected Member Functions

 _buildCallback (Zend_Server_Reflection_Function_Abstract $reflection)
 
 _buildSignature (Zend_Server_Reflection_Function_Abstract $reflection, $class=null)
 
 _dispatch (Zend_Server_Method_Definition $invocable, array $params)
 
 _fixType ($type)
 

Protected Attributes

 $_overwriteExistingMethods = false
 
 $_table
 

Static Protected Attributes

static $magic_methods
 

Detailed Description

Definition at line 58 of file Abstract.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructor

Setup server description

Returns
void

Definition at line 96 of file Abstract.php.

97  {
98  $this->_table = new Zend_Server_Definition();
99  $this->_table->setOverwriteExistingMethods($this->_overwriteExistingMethods);
100  }

Member Function Documentation

◆ _buildCallback()

_buildCallback ( Zend_Server_Reflection_Function_Abstract  $reflection)
protected

Build callback for method signature

Parameters
Zend_Server_Reflection_Function_Abstract$reflection
Returns
Zend_Server_Method_Callback

Definition at line 136 of file Abstract.php.

137  {
138  $callback = new Zend_Server_Method_Callback();
139  if ($reflection instanceof Zend_Server_Reflection_Method) {
140  $callback->setType($reflection->isStatic() ? 'static' : 'instance')
141  ->setClass($reflection->getDeclaringClass()->getName())
142  ->setMethod($reflection->getName());
143  } elseif ($reflection instanceof Zend_Server_Reflection_Function) {
144  $callback->setType('function')
145  ->setFunction($reflection->getName());
146  }
147  return $callback;
148  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
setClass($class, $namespace='', $argv=null)

◆ _buildSignature()

_buildSignature ( Zend_Server_Reflection_Function_Abstract  $reflection,
  $class = null 
)
protected

Build a method signature

Parameters
Zend_Server_Reflection_Function_Abstract$reflection
null | string | object$class
Returns
Zend_Server_Method_Definition
Exceptions
Zend_Server_Exceptionon duplicate entry

Definition at line 158 of file Abstract.php.

159  {
160  $ns = $reflection->getNamespace();
161  $name = $reflection->getName();
162  $method = empty($ns) ? $name : $ns . '.' . $name;
163 
164  if (!$this->_overwriteExistingMethods && $this->_table->hasMethod($method)) {
165  #require_once 'Zend/Server/Exception.php';
166  throw new Zend_Server_Exception('Duplicate method registered: ' . $method);
167  }
168 
169  $definition = new Zend_Server_Method_Definition();
170  $definition->setName($method)
171  ->setCallback($this->_buildCallback($reflection))
172  ->setMethodHelp($reflection->getDescription())
173  ->setInvokeArguments($reflection->getInvokeArguments());
174 
175  foreach ($reflection->getPrototypes() as $proto) {
176  $prototype = new Zend_Server_Method_Prototype();
177  $prototype->setReturnType($this->_fixType($proto->getReturnType()));
178  foreach ($proto->getParameters() as $parameter) {
179  $param = new Zend_Server_Method_Parameter(array(
180  'type' => $this->_fixType($parameter->getType()),
181  'name' => $parameter->getName(),
182  'optional' => $parameter->isOptional(),
183  ));
184  if ($parameter->isDefaultValueAvailable()) {
185  $param->setDefaultValue($parameter->getDefaultValue());
186  }
187  $prototype->addParameter($param);
188  }
189  $definition->addPrototype($prototype);
190  }
191  if (is_object($class)) {
192  $definition->setObject($class);
193  }
194  $this->_table->addMethod($definition);
195  return $definition;
196  }
$_option $_optionId $class
Definition: date.phtml:13
$method
Definition: info.phtml:13
_buildCallback(Zend_Server_Reflection_Function_Abstract $reflection)
Definition: Abstract.php:136
if(!isset($_GET['name'])) $name
Definition: log.php:14

◆ _dispatch()

_dispatch ( Zend_Server_Method_Definition  $invocable,
array  $params 
)
protected

Dispatch method

Parameters
Zend_Server_Method_Definition$invocable
array$params
Returns
mixed

Definition at line 205 of file Abstract.php.

206  {
207  $callback = $invocable->getCallback();
208  $type = $callback->getType();
209 
210  if ('function' == $type) {
211  $function = $callback->getFunction();
212  return call_user_func_array($function, $params);
213  }
214 
215  $class = $callback->getClass();
216  $method = $callback->getMethod();
217 
218  if ('static' == $type) {
219  return call_user_func_array(array($class, $method), $params);
220  }
221 
222  $object = $invocable->getObject();
223  if (!is_object($object)) {
224  $invokeArgs = $invocable->getInvokeArguments();
225  if (!empty($invokeArgs)) {
226  $reflection = new ReflectionClass($class);
227  $object = $reflection->newInstanceArgs($invokeArgs);
228  } else {
229  $object = new $class;
230  }
231  }
232  return call_user_func_array(array($object, $method), $params);
233  }
$type
Definition: item.phtml:13
$_option $_optionId $class
Definition: date.phtml:13
$method
Definition: info.phtml:13
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18

◆ _fixType()

_fixType (   $type)
abstractprotected

Map PHP type to protocol type

Parameters
string$type
Returns
string

◆ getFunctions()

getFunctions ( )

Returns a list of registered methods

Returns an array of method definitions.

Returns
Zend_Server_Definition

Implements Zend_Server_Interface.

Definition at line 109 of file Abstract.php.

110  {
111  return $this->_table;
112  }

◆ lowerCase()

static lowerCase ( $value,
$key 
)
static

Lowercase a string

Lowercase's a string by reference

Deprecated:
Parameters
string$stringvalue
string$key
Returns
string Lower cased string

Definition at line 124 of file Abstract.php.

125  {
126  trigger_error(__CLASS__ . '::' . __METHOD__ . '() is deprecated and will be removed in a future version', E_USER_NOTICE);
127  return $value = strtolower($value);
128  }
$value
Definition: gender.phtml:16

Field Documentation

◆ $_overwriteExistingMethods

$_overwriteExistingMethods = false
protected

Definition at line 82 of file Abstract.php.

◆ $_table

$_table
protected

Definition at line 87 of file Abstract.php.

◆ $magic_methods

$magic_methods
staticprotected
Initial value:
= array(
'__call',
'__clone',
'__construct',
'__destruct',
'__get',
'__isset',
'__set',
'__set_state',
'__sleep',
'__tostring',
'__unset',
'__wakeup',
)

Definition at line 64 of file Abstract.php.


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