diff --git a/src/Analytics/Analytics.php b/src/Analytics/Analytics.php index 3f30f5a..1d4b5a8 100644 --- a/src/Analytics/Analytics.php +++ b/src/Analytics/Analytics.php @@ -16,20 +16,24 @@ abstract class Analytics { - protected $enabled = true; + protected bool $enabled = true; /** * Enables tracking for this instance. + * + * @return void */ - public function enable() + public function enable(): void { $this->enabled = true; } /** * Disables tracking for this instance. + * + * @return void */ - public function disable() + public function disable(): void { $this->enabled = false; } @@ -40,8 +44,9 @@ public function disable() * * @return string */ - static public function getUniqueByHostname():string { + static public function getUniqueByHostname(): string + { $host = gethostname(); - return md5(gethostbyname($host).$host); + return md5(gethostbyname($host) . $host); } } diff --git a/src/Analytics/GoogleAnalytics.php b/src/Analytics/GoogleAnalytics.php index b1b76e5..ba19275 100644 --- a/src/Analytics/GoogleAnalytics.php +++ b/src/Analytics/GoogleAnalytics.php @@ -51,7 +51,7 @@ public function __construct(string $tid, string $cid) * @param string $label * Specifies the event label. * - * @param string $value + * @param null|int $value * Specifies the event value. Values must be non-negative. * * @return bool @@ -109,7 +109,7 @@ public function createPageView(string $hostname, string $page, string $title = n return true; } - private function execute(array $query) + private function execute(array $query): void { $ch = curl_init(); @@ -124,7 +124,7 @@ private function execute(array $query) curl_close($ch); } - private function prepareCurl(&$ch, array $query) + private function prepareCurl(&$ch, array $query): void { curl_setopt($ch, CURLOPT_URL, self::URL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);