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


PHP Url::fromString方法代码示例

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


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

示例1: testHostAndPort

 public function testHostAndPort()
 {
     $urlStr = 'foo:8080';
     $url = Url::fromString($urlStr);
     $this->assertEquals('foo', $url->getHost());
     $this->assertEquals('8080', $url->getPort());
 }
开发者ID:fliglio,项目名称:web,代码行数:7,代码来源:UrlTest.php

示例2: resolve

 /**
  * @param  RequestInterface $request
  * @param  MapInterface<string, AttributeInterface> $attributes
  * @param  UrlInterface $target
  */
 public function resolve(RequestInterface $request, MapInterface $attributes, UrlInterface $target) : UrlInterface
 {
     $base = $request->url();
     if ($attributes->contains(BaseParser::key())) {
         $base = $attributes->get(BaseParser::key())->content();
     }
     return Url::fromString($this->resolver->resolve((string) $base, (string) $target));
 }
开发者ID:innmind,项目名称:crawler,代码行数:13,代码来源:UrlResolver.php

示例3: server

 public function server(string $url) : ServerInterface
 {
     $url = Url::fromString($url);
     $hash = md5((string) $url);
     if ($this->servers->contains($hash)) {
         return $this->servers->get($hash);
     }
     $server = $this->makeServer($url);
     $this->servers = $this->servers->put($hash, $server);
     return $server;
 }
开发者ID:innmind,项目名称:rest-client,代码行数:11,代码来源:Client.php

示例4: get

 public function get(string $name) : HttpResource
 {
     if (!$this->names()->contains($name)) {
         throw new InvalidArgumentException();
     }
     if ($this->definitions->contains($name)) {
         return $this->definitions->get($name);
     }
     $url = $this->resolver->resolve((string) $this->host, (string) $this->paths->get($name));
     $url = Url::fromString($url);
     $response = $this->transport->fulfill(new Request($url, new Method(Method::OPTIONS), new ProtocolVersion(1, 1), new Headers(new Map('string', HeaderInterface::class)), new NullStream()));
     $definition = $this->factory->make($name, $url, $response);
     $this->definitions = $this->definitions->put($name, $definition);
     return $definition;
 }
开发者ID:innmind,项目名称:rest-client,代码行数:15,代码来源:Capabilities.php

示例5: getTagList

 /**
  * Returns protected var $oberserver.
  * @param string observer key
  * @return array
  */
 public function getTagList($param)
 {
     $id = $param['id'];
     $tree_id = $param['tree_id'];
     $url_edit = new Url();
     $url_del = new Url();
     $url_edit->fromString($param['href_edit_theme_tag']);
     $url_del->fromString($param['href_del_theme_tag']);
     try {
         $siteTag = new SystemSiteTag();
         $theme = $this->director->themeManager->getThemeFromId(array('id' => $id));
         $usedTags = $siteTag->getTagList(array('tree_id' => $tree_id));
         $taglist = $theme->getTagList();
         foreach ($taglist as &$item) {
             $item['userdefined'] = array_key_exists($item['id'], $usedTags) ? join(', ', $usedTags[$item['id']]) : '';
             $url_edit->setParameter('parent_tag', $item['id']);
             $url_del->setParameter('parent_tag', $item['id']);
             $item['href_edit'] = $url_edit->getUrl();
             $item['href_del'] = $item['userdefined'] ? $url_del->getUrl() : '';
         }
         return array_values($taglist);
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
开发者ID:rverbrugge,项目名称:dif,代码行数:30,代码来源:ThemeHandler.php

示例6: resolveUrl

 private function resolveUrl(UrlInterface $url, IdentityInterface $identity) : UrlInterface
 {
     $url = (string) $url;
     $url = rtrim($url, '/') . '/' . $identity;
     return Url::fromString($url);
 }
开发者ID:innmind,项目名称:rest-client,代码行数:6,代码来源:Server.php

示例7: webhookUrl

 /**
  * @param string $webhookUrl
  * @return Url|null
  */
 public function webhookUrl($webhookUrl = null)
 {
     if ($webhookUrl !== null) {
         $this->webhookUrl = Url::fromString($webhookUrl);
     }
     return $this->webhookUrl;
 }
开发者ID:gingerpayments,项目名称:ginger-php,代码行数:11,代码来源:Order.php

示例8: fromArray

 /**
  * @param array $order
  * @return Order
  */
 public static function fromArray(array $order)
 {
     Guard::keyExists($order, 'transactions');
     Guard::keyExists($order, 'amount');
     Guard::keyExists($order, 'currency');
     return new static(Transactions::fromArray($order['transactions']), Amount::fromInteger($order['amount']), Currency::fromString($order['currency']), array_key_exists('description', $order) ? Description::fromString($order['description']) : null, array_key_exists('merchant_order_id', $order) ? MerchantOrderId::fromString($order['merchant_order_id']) : null, array_key_exists('return_url', $order) ? Url::fromString($order['return_url']) : null, array_key_exists('expiration_period', $order) ? new \DateInterval($order['expiration_period']) : null, array_key_exists('id', $order) ? Uuid::fromString($order['id']) : null, array_key_exists('project_id', $order) ? Uuid::fromString($order['project_id']) : null, array_key_exists('created', $order) ? new Carbon($order['created']) : null, array_key_exists('modified', $order) ? new Carbon($order['modified']) : null, array_key_exists('completed', $order) ? new Carbon($order['completed']) : null, array_key_exists('status', $order) ? Status::fromString($order['status']) : null);
 }
开发者ID:duronrulez,项目名称:ginger-php,代码行数:11,代码来源:Order.php

示例9: parseValues

 protected function parseValues(SetInterface $values)
 {
     return $values->reduce(new Set(UrlInterface::class), function (Set $urls, string $url) : Set {
         return $urls->add(Url::fromString($url));
     });
 }
开发者ID:innmind,项目名称:crawler,代码行数:6,代码来源:ImageParser.php


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