aboutsummaryrefslogtreecommitdiff
path: root/src/Environments
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2020-07-15 13:57:48 +0300
committerValentin Popov <info@valentineus.link>2020-07-15 13:57:48 +0300
commitecabedfa1f7a8cbba7a522ca8440b82063d04686 (patch)
tree73ae8bafff610e6de3d1b8e51d1be090a0633524 /src/Environments
parent76e8ed954e2a1c70437fb34a927d1bb1d921d3ce (diff)
downloadphp-epg-service-ecabedfa1f7a8cbba7a522ca8440b82063d04686.tar.xz
php-epg-service-ecabedfa1f7a8cbba7a522ca8440b82063d04686.zip
Updated service environment
Signed-off-by: Valentin Popov <info@valentineus.link>
Diffstat (limited to 'src/Environments')
-rw-r--r--src/Environments/ServiceEnvironment.php26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/Environments/ServiceEnvironment.php b/src/Environments/ServiceEnvironment.php
index c24f6a6..ade87c1 100644
--- a/src/Environments/ServiceEnvironment.php
+++ b/src/Environments/ServiceEnvironment.php
@@ -28,15 +28,35 @@ class ServiceEnvironment {
/**
* @var string
*/
- private const BASE_URL = 'http://xmldata.epgservice.ru/EPGService/hs/xmldata/%s/%s';
+ protected const BASE_URL = 'http://xmldata.epgservice.ru/EPGService/hs/xmldata/%s/%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);
+ }
+
+ /**
* @param string $method
*
* @return string
*/
- public static function getUrl(string $key, string $method = ''): string {
- return sprintf(self::BASE_URL, $key, $method);
+ public function getUrl(string $method = ''): string {
+ return sprintf(self::BASE_URL, $this->key, $method);
}
}