* @license http://www.apache.org/licenses/LICENSE-2.0 * @package EPGService\Environments */ class ServiceEnvironment { /** * @var string */ protected const BASE_URL = 'http://xmldata.epgservice.ru/EPGService/hs/xmldata/%s/'; /** * @var string */ private string $key; /** * @param string $key */ protected function __construct(string $key) { $this->key = $key; } /** * @param string $key * * @return \EPGService\Environments\ServiceEnvironment */ public static function create(string $key): ServiceEnvironment { return new ServiceEnvironment($key); } /** * @return string */ public function getUrl(): string { return sprintf(self::BASE_URL, $this->key); } }