Definition at line 35 of file Service.php.
◆ __construct()
Constructor
- Parameters
-
- Returns
- void
- Exceptions
-
Definition at line 124 of file Service.php.
126 if (is_string($spec)) {
128 }
elseif (is_array($spec)) {
132 if (
null == $this->
getName()) {
133 #require_once 'Zend/Json/Server/Exception.php';
elseif(isset( $params[ 'redirect_parent']))
setOptions(array $options)
◆ __toString()
Cast to string
- Returns
- string
Definition at line 442 of file Service.php.
◆ _validateParamType()
_validateParamType |
( |
|
$type, |
|
|
|
$isReturn = false |
|
) |
| |
|
protected |
Validate parameter type
- Parameters
-
- Returns
- true
- Exceptions
-
Definition at line 454 of file Service.php.
456 if (!is_string(
$type)) {
457 #require_once 'Zend/Json/Server/Exception.php'; 461 if (!array_key_exists(
$type, $this->_paramMap)) {
465 $paramType = $this->_paramMap[
$type];
466 if (!$isReturn && (
'null' == $paramType)) {
467 #require_once 'Zend/Json/Server/Exception.php';
◆ addParam()
addParam |
( |
|
$type, |
|
|
array |
$options = array() , |
|
|
|
$order = null |
|
) |
| |
Add a parameter to the service
- Parameters
-
string | array | $type | |
array | $options | |
int | null | $order | |
- Returns
- Zend_Json_Server_Smd_Service
Definition at line 273 of file Service.php.
275 if (is_string(
$type)) {
278 foreach (
$type as $key => $paramType) {
282 #require_once 'Zend/Json/Server/Exception.php'; 286 $paramOptions = array(
290 if (in_array($key, array_keys($this->_paramOptionTypes))) {
291 if (
null !== ($callback = $this->_paramOptionTypes[$key])) {
296 $paramOptions[$key] =
$value;
300 $this->_params[] = array(
301 'param' => $paramOptions,
elseif(isset( $params[ 'redirect_parent']))
_validateParamType($type, $isReturn=false)
◆ addParams()
addParams |
( |
array |
$params | ) |
|
Add params
Each param should be an array, and should include the key 'type'.
- Parameters
-
- Returns
- Zend_Json_Server_Smd_Service
Definition at line 316 of file Service.php.
323 if (!array_key_exists(
'type',
$options)) {
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
addParam($type, array $options=array(), $order=null)
◆ getEnvelope()
Get envelope type
- Returns
- string
Definition at line 260 of file Service.php.
◆ getName()
Retrieve name
- Returns
- string
Definition at line 182 of file Service.php.
◆ getParams()
Get all parameters
Returns all params in specified order.
- Returns
- array
Definition at line 352 of file Service.php.
356 foreach ($this->_params as $param) {
357 if (
null === $param[
'order']) {
364 $params[$param[
'order']] = $param[
'param'];
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ getReturn()
Get return type
- Returns
- string|array
Definition at line 398 of file Service.php.
◆ getTarget()
Get service target
- Returns
- string
Definition at line 233 of file Service.php.
◆ getTransport()
Get transport
- Returns
- string
Definition at line 211 of file Service.php.
◆ setEnvelope()
setEnvelope |
( |
|
$envelopeType | ) |
|
Set envelope type
- Parameters
-
- Returns
- Zend_Json_Server_Smd_Service
Definition at line 244 of file Service.php.
246 if (!in_array($envelopeType, $this->_envelopeTypes)) {
247 #require_once 'Zend/Json/Server/Exception.php'; 248 throw new Zend_Json_Server_Exception(sprintf(
'Invalid envelope type "%s"; please specify one of (%s)', $envelopeType, implode(
', ', $this->_envelopeTypes)));
251 $this->_envelope = $envelopeType;
◆ setName()
Set service name
- Parameters
-
- Returns
- Zend_Json_Server_Smd_Service
- Exceptions
-
Definition at line 166 of file Service.php.
169 if (!preg_match($this->_nameRegex,
$name)) {
170 #require_once 'Zend/Json/Server/Exception.php'; 173 $this->_name =
$name;
if(!isset($_GET['name'])) $name
◆ setOptions()
setOptions |
( |
array |
$options | ) |
|
◆ setParams()
setParams |
( |
array |
$params | ) |
|
◆ setReturn()
Set return type
- Parameters
-
- Returns
- Zend_Json_Server_Smd_Service
Definition at line 377 of file Service.php.
379 if (is_string(
$type)) {
382 foreach (
$type as $key => $returnType) {
386 #require_once 'Zend/Json/Server/Exception.php'; 389 $this->_return =
$type;
elseif(isset( $params[ 'redirect_parent']))
_validateParamType($type, $isReturn=false)
◆ setTarget()
◆ setTransport()
setTransport |
( |
|
$transport | ) |
|
Set Transport
Currently limited to POST
- Parameters
-
- Returns
- Zend_Json_Server_Smd_Service
Definition at line 195 of file Service.php.
197 if (!in_array($transport, $this->_transportTypes)) {
198 #require_once 'Zend/Json/Server/Exception.php'; 199 throw new Zend_Json_Server_Exception(sprintf(
'Invalid transport "%s"; please select one of (%s)', $transport, implode(
', ', $this->_transportTypes)));
202 $this->_transport = $transport;
◆ toArray()
Cast service description to array
- Returns
- array
Definition at line 408 of file Service.php.
418 return compact(
'envelope',
'transport',
'parameters',
'returns');
421 return $paramInfo = compact(
'envelope',
'target',
'transport',
'parameters',
'returns');
if(!isset($_GET['name'])) $name
◆ toJson()
Return JSON encoding of service
- Returns
- string
Definition at line 429 of file Service.php.
433 #require_once 'Zend/Json.php';
static encode($valueToEncode, $cycleCheck=false, $options=array())
◆ $_envelope
◆ $_envelopeTypes
◆ $_name
◆ $_nameRegex
$_nameRegex = '/^[a-z][a-z0-9._]+$/i' |
|
protected |
◆ $_paramMap
Initial value:= array(
'any' => 'any',
'arr' => 'array',
'array' => 'array',
'assoc' => 'object',
'bool' => 'boolean',
'boolean' => 'boolean',
'dbl' => 'float',
'double' => 'float',
'false' => 'boolean',
'float' => 'float',
'hash' => 'object',
'integer' => 'integer',
'int' => 'integer',
'mixed' => 'any',
'nil' => 'null',
'null' => 'null',
'object' => 'object',
'string' => 'string',
'str' => 'string',
'struct' => 'object',
'true' => 'boolean',
'void' => 'null',
)
Definition at line 84 of file Service.php.
◆ $_paramOptionTypes
Initial value:= array(
'name' => 'is_string',
'optional' => 'is_bool',
'default' => null,
'description' => 'is_string',
)
Definition at line 67 of file Service.php.
◆ $_params
◆ $_return
◆ $_target
◆ $_transport
◆ $_transportTypes
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Json/Server/Smd/Service.php