コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function define($location)
 {
     if (!$location instanceof LocationInterface) {
         $location = new Location($location, []);
     }
     $name = $location->name();
     if (isset($this->endpoints[$name]) && !$this->endpoints[$name] instanceof ServiceInterface) {
         throw AmbiguousServiceException::makeAlreadyDiscovered($name);
     }
     if (!isset($this->endpoints[$name])) {
         $this->endpoints[$name] = new Service($location);
     }
     return $this->endpoints[$name];
 }
コード例 #2
0
 /**
  * Location should return first URL when matching preferred schemas.
  */
 public function testGettingUnsupportedUrl()
 {
     $url = $this->location->url(['sftp', 'ftp']);
     $this->assertNull($url);
 }