name = $name; $this->url = $url; try { foreach ($endpoints as $endpoint) { $endpoint += ['formats' => [], 'schemes' => [], 'discovery' => FALSE]; $this->endpoints[] = new Endpoint($endpoint['url'], $this, $endpoint['schemes'], $endpoint['formats'], $endpoint['discovery']); } } catch (\InvalidArgumentException $e) { // Just skip all the invalid endpoints. // @todo Log the exception message to help with debugging in // https://www.drupal.org/project/drupal/issues/2972846. } if (empty($this->endpoints)) { throw new ProviderException('Provider @name does not define any valid endpoints.', $this); } } /** * Returns the provider name. * * @return string * Name of the provider. */ public function getName() { return $this->name; } /** * Returns the provider URL. * * @return string * URL of the provider. */ public function getUrl() { return $this->url; } /** * Returns the provider endpoints. * * @return \Drupal\media\OEmbed\Endpoint[] * List of endpoints this provider exposes. */ public function getEndpoints() { return $this->endpoints; } }