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


PHP ParameterBag::remove方法代码示例

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


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

示例1: testRemove

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

示例2: 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

示例3: map

 /**
  * @inheritdoc
  */
 public function map(ParameterBag $item)
 {
     foreach ($this->mapping as $from => $to) {
         // use a special kind of null value to check, because we do want a
         // `null` value if it's actually set, but we cannot use the has()
         // method on deep paths, like foo[bar]
         if ('__null__' === ($value = $item->get($from, '__null__', $this->deep))) {
             continue;
         }
         // if value is null, only set it when we don't already have this value
         if ($item->has($to) && !$this->mayOverride($item->get($to), $value)) {
             $item->remove($from);
             continue;
         }
         $item->set($to, $value);
         // remove the original if the key is mapped to a different key
         if ($to !== $from) {
             $item->remove($from);
         }
     }
     return $item;
 }
开发者ID:treehouselabs,项目名称:feeder,代码行数:25,代码来源:PathMapper.php

示例4:

 function it_posts_users_action(Request $request, ParameterBag $bag, ContainerInterface $container, UserRepository $repository, UserInterface $user, UserHandler $handler, Mailer $mailer)
 {
     $request->request = $bag;
     $bag->get('force')->shouldBeCalled()->willReturn(false);
     $bag->remove('force')->shouldBeCalled();
     $container->get('kreta_user.repository.user')->shouldBeCalled()->willReturn($repository);
     $bag->get('email')->shouldBeCalled()->willReturn('kreta@kreta.com');
     $repository->findOneBy(['email' => 'kreta@kreta.com'])->shouldBeCalled()->willReturn($user);
     $container->get('kreta_user.form_handler.invitation')->shouldBeCalled()->willReturn($handler);
     $user->isEnabled()->shouldBeCalled()->willReturn(true);
     $handler->processForm($request, $user)->shouldBeCalled()->willReturn($user);
     $handler->processForm($request)->shouldBeCalled()->willReturn($user);
     $container->get('kreta_user.mailer')->shouldBeCalled()->willReturn($mailer);
     $mailer->sendInvitationEmail($user)->shouldBeCalled();
     $this->postUsersAction($request)->shouldReturn($user);
 }
开发者ID:dasklney,项目名称:kreta,代码行数:16,代码来源:InvitationControllerSpec.php

示例5: remove

 /**
  * Removes a route parameter.
  *
  * @param string $parameterName
  */
 public function remove($parameterName)
 {
     $this->params->remove($parameterName);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:9,代码来源:RouteReference.php

示例6: parseConnections

 protected function parseConnections($options, $defaultHost, $defaultPort)
 {
     if (isset($options['host']) || isset($options['port'])) {
         $options['connections'][] = $options;
     } elseif ($options['connection']) {
         $options['connections'][] = $options['connection'];
     }
     /** @var ParameterBag[] $toParse */
     $toParse = [];
     if (isset($options['connections'])) {
         foreach ((array) $options['connections'] as $alias => $conn) {
             if (is_string($conn)) {
                 $conn = ['host' => $conn];
             }
             $conn += ['scheme' => 'tcp', 'host' => $defaultHost, 'port' => $defaultPort];
             $conn = new ParameterBag($conn);
             if ($conn->has('password')) {
                 $conn->set('pass', $conn->get('password'));
                 $conn->remove('password');
             }
             $conn->set('uri', Uri::fromParts($conn->all()));
             $toParse[] = $conn;
         }
     } elseif (isset($options['save_path'])) {
         foreach (explode(',', $options['save_path']) as $conn) {
             $uri = new Uri($conn);
             $connBag = new ParameterBag();
             $connBag->set('uri', $uri);
             $connBag->add(parse_query($uri->getQuery()));
             $toParse[] = $connBag;
         }
     }
     $connections = [];
     foreach ($toParse as $conn) {
         /** @var Uri $uri */
         $uri = $conn->get('uri');
         $parts = explode(':', $uri->getUserInfo(), 2);
         $password = isset($parts[1]) ? $parts[1] : null;
         $connections[] = ['scheme' => $uri->getScheme(), 'host' => $uri->getHost(), 'port' => $uri->getPort(), 'path' => $uri->getPath(), 'alias' => $conn->get('alias'), 'prefix' => $conn->get('prefix'), 'password' => $password, 'database' => $conn->get('database'), 'persistent' => $conn->get('persistent'), 'weight' => $conn->get('weight'), 'timeout' => $conn->get('timeout')];
     }
     return $connections;
 }
开发者ID:gandalf3,项目名称:bolt,代码行数:42,代码来源:SessionServiceProvider.php

示例7: parseConnections

 protected function parseConnections($options, $defaultHost, $defaultPort, $defaultScheme = 'tcp')
 {
     if (isset($options['host']) || isset($options['port'])) {
         $options['connections'][] = $options;
     } elseif ($options['connection']) {
         $options['connections'][] = $options['connection'];
     }
     /** @var ParameterBag[] $toParse */
     $toParse = [];
     if (isset($options['connections'])) {
         foreach ((array) $options['connections'] as $alias => $conn) {
             if (is_string($conn)) {
                 $conn = ['host' => $conn];
             }
             $conn += ['scheme' => $defaultScheme, 'host' => $defaultHost, 'port' => $defaultPort];
             $conn = new ParameterBag($conn);
             if ($conn->has('password')) {
                 $conn->set('pass', $conn->get('password'));
                 $conn->remove('password');
             }
             $conn->set('uri', Uri::fromParts($conn->all()));
             $toParse[] = $conn;
         }
     } else {
         $connections = isset($options['save_path']) ? (array) explode(',', $options['save_path']) : [];
         if (empty($connections)) {
             $connections[] = $defaultHost . ':' . $defaultPort;
         }
         foreach ($connections as $conn) {
             // Default scheme if not given so parse_url works correctly.
             if (!preg_match('~^\\w+://.+~', $conn)) {
                 $conn = $defaultScheme . '://' . $conn;
             }
             $uri = new Uri($conn);
             $connBag = new ParameterBag();
             $connBag->set('uri', $uri);
             $connBag->add(Psr7\parse_query($uri->getQuery()));
             $toParse[] = $connBag;
         }
     }
     $connections = [];
     foreach ($toParse as $conn) {
         /** @var Uri $uri */
         $uri = $conn->get('uri');
         $parts = explode(':', $uri->getUserInfo(), 2);
         $password = isset($parts[1]) ? $parts[1] : null;
         $connections[] = ['scheme' => $uri->getScheme(), 'host' => $uri->getHost(), 'port' => $uri->getPort(), 'path' => $uri->getPath(), 'alias' => $conn->get('alias'), 'prefix' => $conn->get('prefix'), 'password' => $password, 'database' => $conn->get('database'), 'persistent' => $conn->get('persistent'), 'weight' => $conn->get('weight'), 'timeout' => $conn->get('timeout')];
     }
     return $connections;
 }
开发者ID:bolt,项目名称:bolt,代码行数:50,代码来源:SessionServiceProvider.php

示例8: insertExternalResources

 /**
  * Insert every external resources: css and header js will be added before page '</head>' and
  * footer javascript will be added before page '</body>'.
  *
  * @return self
  */
 private function insertExternalResources()
 {
     $header_render = '';
     foreach ($this->externalResources->get(self::CSS_LINK, array()) as $href) {
         $header_render .= $this->generateStylesheetTag($href);
     }
     foreach ($header_js = $this->externalResources->get(self::HEADER_JS, array()) as $src) {
         $header_render .= $this->generateJavascriptTag($src);
     }
     if (!empty($header_render)) {
         $this->setRender(str_replace('</head>', "{$header_render}</head>", $this->getRender()));
     }
     $footer_render = '';
     $footer_js = array_diff($this->externalResources->get(self::FOOTER_JS, array()), $header_js);
     foreach ($footer_js as $src) {
         $footer_render .= $this->generateJavascriptTag($src);
     }
     if (!empty($footer_render)) {
         $this->setRender(str_replace('</body>', "{$footer_render}</body>", $this->getRender()));
     }
     $this->externalResources->remove(self::CSS_LINK);
     $this->externalResources->remove(self::HEADER_JS);
     $this->externalResources->remove(self::FOOTER_JS);
     return $this;
 }
开发者ID:gobjila,项目名称:BackBee,代码行数:31,代码来源:Renderer.php


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