当前位置: 首页>>代码示例>>PHP>>正文


PHP ParameterBag::keys方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpFoundation\ParameterBag::keys方法的典型用法代码示例。如果您正苦于以下问题:PHP ParameterBag::keys方法的具体用法?PHP ParameterBag::keys怎么用?PHP ParameterBag::keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpFoundation\ParameterBag的用法示例。


在下文中一共展示了ParameterBag::keys方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: transform

 /**
  * @inheritdoc
  */
 public function transform(ParameterBag $item)
 {
     foreach ($item->keys() as $key) {
         if (!in_array($key, $this->fields)) {
             $item->remove($key);
         }
     }
 }
开发者ID:treehouselabs,项目名称:feeder,代码行数:11,代码来源:ObsoleteFieldsTransformer.php

示例2: it_sets_found_object_as_request_parameter

 public function it_sets_found_object_as_request_parameter(ParamConverter $paramConverter, TranslatableMetadata $translatableMetadata, Request $request, ParameterBag $attributes, TranslatableRepository $translatableRepository, \stdClass $object)
 {
     $paramConverter->getClass()->willReturn('TranslatableEntity');
     $paramConverter->getName()->willReturn('object');
     $translatableMetadata->hasTranslatableProperties()->willReturn(true);
     $request->getLocale()->willReturn('some_locale');
     $request->attributes = $attributes;
     $attributes->keys()->willReturn(array('translatableProperty'));
     $attributes->get('translatableProperty')->willReturn('translationValue');
     $translatableMetadata->getTranslatableProperties()->willReturn(array('translations' => array('translatableProperty' => 'translationField')));
     $translatableRepository->findTranslatableOneBy(array('translatableProperty' => 'translationValue'), null, 'some_locale')->willReturn($object);
     $attributes->set('object', $object)->shouldBeCalled();
     $this->apply($request, $paramConverter);
 }
开发者ID:norzechowicz,项目名称:doctrine-extensions-bundle,代码行数:14,代码来源:TranslatableParamConverterSpec.php

示例3: getLayoutFile

 /**
  * Return the file path to current layout, try to create it if not exists.
  *
  * @param Layout $layout
  *
  * @return string the file path
  *
  * @throws RendererException
  */
 protected function getLayoutFile(Layout $layout)
 {
     $layoutfile = $layout->getPath();
     if (null === $layoutfile && 0 < $this->manageableExt->count()) {
         $adapter = null;
         if (null !== $this->defaultAdapter && null !== ($adapter = $this->rendererAdapters->get($this->defaultAdapter))) {
             $extensions = $adapter->getManagedFileExtensions();
         } else {
             $extensions = $this->manageableExt->keys();
         }
         if (0 === count($extensions)) {
             throw new RendererException('Declared adapter(s) (count:' . $this->rendererAdapters->count() . ') is/are not able to manage ' . 'any file extensions at moment.');
         }
         $layoutfile = StringUtils::toPath($layout->getLabel(), array('extension' => reset($extensions)));
         $layout->setPath($layoutfile);
     }
     return $layoutfile;
 }
开发者ID:ReissClothing,项目名称:BackBee,代码行数:27,代码来源:Renderer.php

示例4: getTemplateFile

 /**
  * Try to compute and guess a valid filename for $object:
  * 		- on success return string which is the right filename with its extension
  * 		- on fail return false.
  *
  * @param  RenderableInterface    $object
  * @param  string         $mode
  * @return string|boolean string if successfully found a valid file name, else false
  */
 private function getTemplateFile(RenderableInterface $object, $mode = null)
 {
     $tmpStorage = $this->templateFile;
     $template = $this->getTemplatePath($object);
     foreach ($this->manageableExt->keys() as $ext) {
         $this->templateFile = $template . (null !== $mode ? '.' . $mode : '') . $ext;
         if ($this->isValidTemplateFile($this->templateFile)) {
             $filename = $this->templateFile;
             $this->templateFile = $tmpStorage;
             return $filename;
         }
     }
     if ($parentClassname = get_parent_class($object)) {
         $parent = new \ReflectionClass($parentClassname);
         if (!$parent->isAbstract()) {
             return $this->getTemplateFile(new $parentClassname(), $mode, null);
         }
     }
     return false;
 }
开发者ID:gobjila,项目名称:BackBee,代码行数:29,代码来源:Renderer.php

示例5: testKeys

 public function testKeys()
 {
     $bag = new ParameterBag(array('foo' => 'bar'));
     $this->assertEquals(array('foo'), $bag->keys());
 }
开发者ID:qasem2rubik,项目名称:laravel,代码行数:5,代码来源:ParameterBagTest.php

示例6: transform

 /**
  * @inheritdoc
  */
 public function transform(ParameterBag $item)
 {
     $keys = $this->field ? [$this->field] : $item->keys();
     $this->replace($item, $keys);
 }
开发者ID:treehouselabs,项目名称:io-bundle,代码行数:8,代码来源:NodeToTextTransformer.php

示例7: updateNode

 /**
  * @param Node $node
  * @param ParameterBag $parameters
  *
  * @return \Guzzle\Http\Message\Response
  *
  * @throws \UnexpectedValueException when trying to update zero parameters
  *                                   or any prohibited parameters
  */
 public function updateNode(Node $node, ParameterBag $parameters)
 {
     $allowableParamKeys = array('name', 'accessIPv4', 'accessIPv6');
     $requestedParamKeys = $parameters->keys();
     if (0 == sizeof($requestedParamKeys)) {
         throw new \UnexpectedValueException(sprintf('Expected values for any of the following properties, but got none: "%s".', implode(', ', $allowableParamKeys)));
     }
     $permittedKeys = array_intersect($requestedParamKeys, $allowableParamKeys);
     $prohibitedKeys = array_diff($requestedParamKeys, $permittedKeys);
     if (sizeof($prohibitedKeys)) {
         throw new \UnexpectedValueException(sprintf('Expected values for any of the following properties "%s". ' . 'The following requested properties are not allowed: "%s".', implode(', ', $allowableParamKeys), implode(', ', $prohibitedKeys)));
     }
     $updates = array();
     foreach ($permittedKeys as $k) {
         $updates[$k] = $parameters->get($k);
     }
     $response = $this->toServer($node)->update($updates);
     # It would be nice to have an updateNodeFromServer so that the caller
     # gets the updates (which $server now has) for their Node. For now, just
     # send some more API requests...
     $nodes = $this->listNodes($node->getId());
     # and update the few properties that might have changed
     $node->setName($nodes[0]->getName());
     $node->setPublicIps($nodes[0]->getPublicIps());
     $node->setState($nodes[0]->getState());
     $node->setExtra($nodes[0]->getExtra());
     return $response;
 }
开发者ID:linkorb,项目名称:libcloud-php,代码行数:37,代码来源:RackspaceProvider.php


注:本文中的Symfony\Component\HttpFoundation\ParameterBag::keys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。