当前位置: 首页>>代码示例>>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;未经允许,请勿转载。