/** * {@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]; }
/** * Location should know its name. */ public function testGettingName() { $name = $this->location->name(); $this->assertEquals('foo', $name); }