當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Parameter::getWireName方法代碼示例

本文整理匯總了PHP中Guzzle\Service\Description\Parameter::getWireName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Parameter::getWireName方法的具體用法?PHP Parameter::getWireName怎麽用?PHP Parameter::getWireName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Guzzle\Service\Description\Parameter的用法示例。


在下文中一共展示了Parameter::getWireName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addXml

 protected function addXml(\XMLWriter $xmlWriter, Parameter $param, $value)
 {
     if ($value === null) {
         return;
     }
     $value = $param->filter($value);
     $type = $param->getType();
     $name = $param->getWireName();
     $prefix = null;
     $namespace = $param->getData('xmlNamespace');
     if (false !== strpos($name, ':')) {
         list($prefix, $name) = explode(':', $name, 2);
     }
     if ($type == 'object' || $type == 'array') {
         if (!$param->getData('xmlFlattened')) {
             $xmlWriter->startElementNS(null, $name, $namespace);
         }
         if ($param->getType() == 'array') {
             $this->addXmlArray($xmlWriter, $param, $value);
         } elseif ($param->getType() == 'object') {
             $this->addXmlObject($xmlWriter, $param, $value);
         }
         if (!$param->getData('xmlFlattened')) {
             $xmlWriter->endElement();
         }
         return;
     }
     if ($param->getData('xmlAttribute')) {
         $this->writeAttribute($xmlWriter, $prefix, $name, $namespace, $value);
     } else {
         $this->writeElement($xmlWriter, $prefix, $name, $namespace, $value);
     }
 }
開發者ID:Ryu0621,項目名稱:SaNaVi,代碼行數:33,代碼來源:XmlVisitor.php

示例2: visit

 /**
  * {@inheritdoc}
  */
 public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
 {
     if ($value instanceof PostFileInterface) {
         $request->addPostFile($value);
     } else {
         $request->addPostFile($param->getWireName(), $value);
     }
 }
開發者ID:xkeygmbh,項目名稱:ifresco-php,代碼行數:11,代碼來源:PostFileVisitor.php

示例3: visit

 public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
 {
     if (isset($this->data[$command])) {
         $json = $this->data[$command];
     } else {
         $json = array();
     }
     $json[$param->getWireName()] = $this->prepareValue($value, $param);
     $this->data[$command] = $json;
 }
開發者ID:adrianoaguiar,項目名稱:magento-elasticsearch-module,代碼行數:10,代碼來源:JsonVisitor.php

示例4: visit

 /**
  * {@inheritdoc}
  */
 public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
 {
     // check if there's a link provided for the param's "wire" name
     $links = $this->get($command, 'links');
     if (!empty($links[$param->getWireName()])) {
         // create a command representing the link
         $linkCommand = $this->builder->createLinkCommand($command, $param, $links[$param->getWireName()]);
         // store the created link command in the results array
         $value[self::ELEMENT][$param->getName()] = $linkCommand;
     }
 }
開發者ID:kameshwariv,項目名稱:testexample,代碼行數:14,代碼來源:LinksVisitor.php

示例5: processXmlAttribute

 protected function processXmlAttribute(Parameter $property, array &$value)
 {
     $sentAs = $property->getWireName();
     if (isset($value['@attributes'][$sentAs])) {
         $value[$property->getName()] = $value['@attributes'][$sentAs];
         unset($value['@attributes'][$sentAs]);
         if (empty($value['@attributes'])) {
             unset($value['@attributes']);
         }
     }
 }
開發者ID:Ryu0621,項目名稱:SaNaVi,代碼行數:11,代碼來源:XmlVisitor.php

示例6: visit

 /**
  * {@inheritdoc}
  */
 public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
 {
     // check if there's embedded resource data for the parameter
     $resourceData = $this->get($command, $this->getFieldName());
     if (!empty($resourceData[$param->getWireName()])) {
         // create the resource representing the embedded resource data
         $resource = $this->createResourceFromData($command, $param, $resourceData[$param->getWireName()]);
         // store the created embedded resource in the results array
         $value[$this->getOutputFieldName()][$param->getName()] = $resource;
     }
 }
開發者ID:dh-open,項目名稱:desk-php,代碼行數:14,代碼來源:AbstractVisitor.php

示例7: visit

 public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
 {
     $name = $param->getName();
     $key = $param->getWireName();
     if (isset($value[$key])) {
         $this->recursiveProcess($param, $value[$key]);
         if ($key != $name) {
             $value[$name] = $value[$key];
             unset($value[$key]);
         }
     }
 }
開發者ID:jorjoh,項目名稱:Varden,代碼行數:12,代碼來源:JsonVisitor.php

示例8: visit

 /**
  * {@inheritdoc}
  */
 public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
 {
     // check if there's an embedded resource for the parameter's
     // "wire" name
     $resources = $this->get($command, 'embedded');
     if (!empty($resources[$param->getWireName()])) {
         // create a model representing the embedded resource data
         $embeddedModel = $this->builder->createEmbeddedModel($command, $param, $resources[$param->getWireName()]);
         // store the created embedded model in the results array
         $value[self::ELEMENT][$param->getName()] = $embeddedModel;
     }
 }
開發者ID:kameshwariv,項目名稱:testexample,代碼行數:15,代碼來源:EmbeddedVisitor.php

示例9: visit

 /**
  * {@inheritdoc}
  */
 public function visit(CommandInterface $command, Response $response, Parameter $param, &$value, $context = null)
 {
     $sentAs = $param->getWireName();
     $name = $param->getName();
     if (isset($value[$sentAs])) {
         $this->recursiveProcess($param, $value[$sentAs]);
         if ($name != $sentAs) {
             $value[$name] = $value[$sentAs];
             unset($value[$sentAs]);
         }
     } elseif ($param->getType() == 'array') {
         // Use a default array when the value is missing
         $value[$name] = array();
     } elseif ($param->getType() == 'boolean') {
         // Use a default value of false when the value is missing
         $value[$name] = false;
     }
 }
開發者ID:xkeygmbh,項目名稱:ifresco-php,代碼行數:21,代碼來源:XmlVisitor.php

示例10: visit

 public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
 {
     $request->getQuery()->set($param->getWireName(), $this->prepareValue($value, $param));
 }
開發者ID:Ryu0621,項目名稱:SaNaVi,代碼行數:4,代碼來源:QueryVisitor.php

示例11: testHasKeyMethod

 public function testHasKeyMethod()
 {
     $p = new Parameter(array('name' => 'foo', 'sentAs' => 'bar'));
     $this->assertEquals('bar', $p->getWireName());
     $p->setSentAs(null);
     $this->assertEquals('foo', $p->getWireName());
 }
開發者ID:Frinstio,項目名稱:AlfredWorkflow.com,代碼行數:7,代碼來源:ParameterTest.php

示例12: addXml

 /**
  * Recursively build the XML body
  *
  * @param \SimpleXMLElement $xml   XML to modify
  * @param Parameter         $param API Parameter
  * @param mixed             $value Value to add
  */
 protected function addXml(\SimpleXMLElement $xml, Parameter $param, $value)
 {
     if ($value === null) {
         return;
     }
     $value = $param->filter($value);
     $type = $param->getType();
     if ($type == 'object' || $type == 'array') {
         $ele = $param->getData('xmlFlattened') ? $xml : $xml->addChild($param->getWireName());
         if ($param->getType() == 'array') {
             $this->addXmlArray($ele, $param, $value, $param->getData('xmlNamespace'));
         } elseif ($param->getType() == 'object') {
             $this->addXmlObject($ele, $param, $value);
         }
     } elseif ($param->getData('xmlAttribute')) {
         $xml->addAttribute($param->getWireName(), $value, $param->getData('xmlNamespace'));
     } else {
         $xml->addChild($param->getWireName(), $value, $param->getData('xmlNamespace'));
     }
 }
開發者ID:creazy412,項目名稱:vmware-win10-c65-drupal7,代碼行數:27,代碼來源:XmlVisitor.php

示例13: visit

 /**
  * {@inheritdoc}
  */
 public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
 {
     $json = isset($this->data[$command]) ? $this->data[$command] : array();
     $json[$param->getWireName()] = $param && is_array($value) ? $this->resolveRecursively($value, $param) : $value;
     $this->data[$command] = $json;
 }
開發者ID:xkeygmbh,項目名稱:ifresco-php,代碼行數:9,代碼來源:JsonVisitor.php

示例14: addXml

 /**
  * Recursively build the XML body
  *
  * @param \SimpleXMLElement $xml   XML to modify
  * @param Parameter         $param API Parameter
  * @param mixed             $value Value to add
  */
 protected function addXml(\SimpleXMLElement $xml, Parameter $param, $value)
 {
     // Determine the name of the element
     $node = $param->getWireName();
     // Check if this property has a particular namespace
     $namespace = $param->getData('xmlNamespace');
     // Filter the value
     $value = $param->filter($value);
     if ($param->getType() == 'array') {
         $this->addXmlArray($xml, $param, $value, $namespace);
     } elseif ($param->getType() == 'object') {
         $this->addXmlObject($xml, $param, $value);
     } elseif ($param->getData('xmlAttribute')) {
         $xml->addAttribute($node, $value, $namespace);
     } else {
         $xml->addChild($node, $value, $namespace);
     }
 }
開發者ID:xkeygmbh,項目名稱:ifresco-php,代碼行數:25,代碼來源:XmlVisitor.php

示例15: visit

 /**
  * {@inheritdoc}
  */
 public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value)
 {
     $request->getQuery()->set($param->getWireName(), $param && is_array($value) ? $this->resolveRecursively($value, $param) : $value);
 }
開發者ID:xkeygmbh,項目名稱:ifresco-php,代碼行數:7,代碼來源:QueryVisitor.php


注:本文中的Guzzle\Service\Description\Parameter::getWireName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。