From 918584c35b90da9dbed39ab9ae9798af17756745 Mon Sep 17 00:00:00 2001 From: Giuseppe Nucifora Date: Thu, 21 Jul 2022 17:53:50 +0200 Subject: [PATCH] add isActive in UptimeRobotApiService --- src/Service/UptimeRobotApiService.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Service/UptimeRobotApiService.php b/src/Service/UptimeRobotApiService.php index b30f321..8353f34 100644 --- a/src/Service/UptimeRobotApiService.php +++ b/src/Service/UptimeRobotApiService.php @@ -9,6 +9,8 @@ use Vdhicts\UptimeRobot\Client\Configuration; class UptimeRobotApiService { + private $apiKey; + /** @var $client */ protected $client; @@ -28,12 +30,22 @@ class UptimeRobotApiService public function __construct(string $apiKey, SerializerInterface $serializer) { - $configuration = new Configuration($apiKey); + $this->apiKey = $apiKey; + $configuration = new Configuration($this->apiKey); $this->client = new Client($configuration); $this->serializer = $serializer; } + /** + * Check if apikey is setted and suppose that api is valid + * + * @return bool + */ + public function isActive(){ + return !empty($this->apiKey); + } + public function getIo(): SymfonyStyle {