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


PHP Assertion::url方法代码示例

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


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

示例1: __construct

 /**
  * IssuerDiscoveryEndpoint constructor.
  *
  * @param \OAuth2\UserAccount\UserAccountManagerInterface $user_account_manager
  * @param \OAuth2\Exception\ExceptionManagerInterface     $exception_manager
  * @param string                                          $issuer               The issuer of the resource
  * @param string                                          $server               The server URI of this discovery service
  */
 public function __construct(UserAccountManagerInterface $user_account_manager, ExceptionManagerInterface $exception_manager, $issuer, $server)
 {
     Assertion::url($issuer, 'The issuer must be an URL.');
     Assertion::url($server, 'The server must be an URL.');
     $this->setUserAccountManager($user_account_manager);
     $this->setExceptionManager($exception_manager);
     $this->setIssuer($issuer);
     $this->computed_server = $this->getDomain($server);
 }
开发者ID:spomky-labs,项目名称:oauth2-server-library,代码行数:17,代码来源:IssuerDiscoveryEndpoint.php

示例2: __construct

 /**
  * Create a new immutable Body instance
  *
  * @param string $route
  * @param string $signature
  * @param array $data
  * @return void
  */
 public function __construct($route, $signature, $data)
 {
     Assertion::url($route);
     Assertion::string($signature);
     Assertion::isArray($data);
     $this->route = $route;
     $this->signature = $signature;
     $this->data = $data;
 }
开发者ID:philipbrown,项目名称:worldpay,代码行数:17,代码来源:Body.php

示例3: __construct

 /**
  * Constructor.
  *
  * @param Identifier $identifier
  * @param \DateTimeImmutable $createdAt
  * @param string $url
  * @param string $visibility
  */
 public function __construct(Identifier $identifier, \DateTimeImmutable $createdAt, $url, $visibility)
 {
     Assertion::choice($visibility, static::$visibilityEnum);
     Assertion::url($url);
     $this->identifier = $identifier;
     $this->createdAt = $createdAt;
     $this->url = $url;
     $this->visibility = $visibility;
 }
开发者ID:ben-gibson,项目名称:foursquare-venue-client,代码行数:17,代码来源:Photo.php

示例4: __construct

 /**
  * Constructor.
  *
  * @param Identifier $identifier
  * @param string $name
  * @param boolean $isPrimary
  */
 public function __construct(Identifier $identifier, $name, $iconUrl, $isPrimary)
 {
     \Assert\that($name)->string()->notEmpty();
     Assertion::boolean($isPrimary);
     Assertion::url($iconUrl);
     $this->identifier = $identifier;
     $this->name = $name;
     $this->iconUrl = $iconUrl;
     $this->isPrimary = $isPrimary;
 }
开发者ID:ben-gibson,项目名称:foursquare-venue-client,代码行数:17,代码来源:Category.php

示例5: __construct

 /**
  * Constructor.
  *
  * @param string $clientId
  * @param string $clientSecret
  * @param string|null $basePath
  */
 public function __construct($clientId, $clientSecret, $basePath = null)
 {
     \Assert\that($clientId)->string()->notEmpty();
     \Assert\that($clientSecret)->string()->notEmpty();
     if ($basePath !== null) {
         Assertion::url($basePath);
         $this->basePath = rtrim($basePath, '/');
     }
     $this->clientId = $clientId;
     $this->clientSecret = $clientSecret;
 }
开发者ID:ben-gibson,项目名称:foursquare-venue-client,代码行数:18,代码来源:Configuration.php

示例6: getAccessToken

 /**
  * Получить AccessToken из консоли
  *
  * @param EventInterface $e
  *
  * @return string|null
  * @throws \Zend\Console\Exception\RuntimeException
  * @throws \Zend\Console\Exception\InvalidArgumentException
  * @throws \Assert\AssertionFailedException
  */
 public function getAccessToken(EventInterface $e)
 {
     if (!Console::isConsole()) {
         return null;
     }
     $authUrl = $e->getParam('authUrl', null);
     Assertion::url($authUrl);
     $console = Console::getInstance();
     $console->writeLine(sprintf('Open the following link in your browser:'));
     $console->writeLine($authUrl);
     $console->writeLine();
     $console->write('Enter verification code: ');
     return $console->readLine();
 }
开发者ID:old-town-gitlab-tools,项目名称:analizator,代码行数:24,代码来源:AccessTokenFromConsole.php

示例7: __construct

 /**
  * @param array $configuration Array with configuration settings
  * @throws InvalidArgumentException
  */
 public function __construct(array $configuration)
 {
     // Validate and set base url
     Assertion::notEmptyKey($configuration, 'apiBaseUrl', 'apiBaseUrl is required');
     Assertion::url($configuration['apiBaseUrl'], 'apiBaseUrl has to be a valid url');
     $this->apiBaseUrl = rtrim($configuration['apiBaseUrl'], '/');
     // Validate username
     Assertion::notEmptyKey($configuration, 'username', 'username is required');
     Assertion::string($configuration['username'], 'username has to be a string');
     $this->username = trim($configuration['username']);
     // Validate api interface id
     Assertion::notEmptyKey($configuration, 'apiId', 'apiId is required');
     Assertion::integer($configuration['apiId'], 'apiId has to be an integer');
     $this->apiId = trim($configuration['apiId']);
     // Validate api key
     Assertion::notEmptyKey($configuration, 'apiKey', 'apiKey is required');
     Assertion::string($configuration['apiKey'], 'apiKey has to be a string');
     $this->apiKey = trim($configuration['apiKey']);
     // Check if clientConfiguration is set and valid
     if (isset($configuration['clientConfiguration'])) {
         Assertion::isArray($configuration['clientConfiguration'], 'clientConfiguration has to be an array');
         $this->clientConfiguration = $configuration['clientConfiguration'];
     }
 }
开发者ID:simplyadmire,项目名称:zaaksysteem,代码行数:28,代码来源:Configuration.php

示例8: testValidUrl

 /**
  * @dataProvider dataValidUrl
  */
 public function testValidUrl($url)
 {
     Assertion::url($url);
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:7,代码来源:AssertTest.php

示例9: checkSectorIdentifierUri

 /**
  * @param string $url
  *
  * @throws \OAuth2\Exception\BadRequestExceptionInterface
  *
  * @return string
  */
 private function checkSectorIdentifierUri($url)
 {
     $allowed_protocols = ['https'];
     if (true === $this->allow_http_connections) {
         $allowed_protocols[] = 'http';
     }
     Assertion::inArray(mb_substr($url, 0, mb_strpos($url, '://', 0, '8bit'), '8bit'), $allowed_protocols, sprintf('The provided sector identifier URI is not valid: scheme must be one of the following: %s.', json_encode($allowed_protocols)));
     $client = new Client(['verify' => !$this->allow_unsecured_connections]);
     $response = $client->get($url);
     Assertion::eq(200, $response->getStatusCode());
     $body = $response->getBody()->getContents();
     $data = json_decode($body, true);
     Assertion::isArray($data, 'The provided sector identifier URI is not valid: bad response.');
     Assertion::notEmpty($data, 'The provided sector identifier URI is not valid: it must contain at least one URI.');
     foreach ($data as $sector_url) {
         Assertion::url($sector_url, 'The provided sector identifier URI is not valid: it must contain only URIs.');
         Assertion::inArray(mb_substr($sector_url, 0, mb_strpos($sector_url, '://', 0, '8bit'), '8bit'), $allowed_protocols, sprintf('An URL provided in the sector identifier URI is not valid: scheme must be one of the following: %s.', json_encode($allowed_protocols)));
     }
 }
开发者ID:spomky-labs,项目名称:oauth2-server-library,代码行数:26,代码来源:SectorIdentifierUriRule.php

示例10: __construct

 public function __construct($url)
 {
     Assertion::url($url);
     $this->url = $url;
 }
开发者ID:nclavaud,项目名称:bookmarks,代码行数:5,代码来源:Url.php

示例11: __construct

 public function __construct($url)
 {
     Assertion::url($url);
     parent::__construct($url);
 }
开发者ID:nclavaud,项目名称:bookmarks,代码行数:5,代码来源:Url.php

示例12: __construct

 /**
  * @param string $location
  *
  * @throws \InvalidArgumentException
  */
 public function __construct($location)
 {
     Assertion::url($location);
     $this->location = $location;
 }
开发者ID:refinery29,项目名称:sitemap,代码行数:10,代码来源:GalleryLocation.php

示例13: setUrl

 /**
  * Устанавливает урл гитлаба
  *
  * @param string $url
  *
  * @return $this
  * @throws \Assert\AssertionFailedException
  */
 public function setUrl($url)
 {
     Assertion::url($url);
     $this->url = $url;
     return $this;
 }
开发者ID:old-town-gitlab-tools,项目名称:core,代码行数:14,代码来源:GitLabDto.php

示例14: __construct

 private function __construct($url)
 {
     Ensure::url($url);
     $this->url = $url;
 }
开发者ID:jeroenvdgulik,项目名称:lonelypullrequests.com,代码行数:5,代码来源:Url.php

示例15: getUriVerificationClosure

 private function getUriVerificationClosure()
 {
     return function ($k, $v) {
         Assertion::url($v, sprintf('The parameter with key "%s" is not a valid URL.', $k));
     };
 }
开发者ID:spomky-labs,项目名称:oauth2-server-library,代码行数:6,代码来源:CommonParametersRule.php


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