From 010466f8f9a9bf09dc97afc10154e5ef3e399886 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Mon, 23 Jun 2014 14:17:56 +0200 Subject: [PATCH] Replace sizeof with count Do not use sizeof to get the length of an array, as the function name 'sizeof' is misleading --- library/Icinga/Chart/Inline/Inline.php | 4 ++-- library/Icinga/Protocol/Dns.php | 4 ++-- .../application/views/scripts/list/servicematrix.phtml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/Icinga/Chart/Inline/Inline.php b/library/Icinga/Chart/Inline/Inline.php index 1040c30a8..bfbd94da3 100644 --- a/library/Icinga/Chart/Inline/Inline.php +++ b/library/Icinga/Chart/Inline/Inline.php @@ -101,14 +101,14 @@ class Inline { foreach ($this->data as $key => $value) { $this->data[$key] = (int)$value; } - for ($i = 0; $i < sizeof($this->data); $i++) { + for ($i = 0; $i < count($this->data); $i++) { $this->labels[] = ''; } if (array_key_exists('colors', $_GET)) { $this->colors = $this->sanitizeStringArray(explode(',', $_GET['colors'])); } - while (sizeof($this->colors) < sizeof($this->data)) { + while (count($this->colors) < count($this->data)) { $this->colors[] = '#FEFEFE'; } diff --git a/library/Icinga/Protocol/Dns.php b/library/Icinga/Protocol/Dns.php index 6dbecf40b..b79681417 100644 --- a/library/Icinga/Protocol/Dns.php +++ b/library/Icinga/Protocol/Dns.php @@ -101,7 +101,7 @@ class Dns public static function ipv4($hostname) { $records = dns_get_record($hostname, DNS_A); - if ($records !== false && sizeof($records) > 0) { + if ($records !== false && count($records) > 0) { return $records[0]['ip']; } return false; @@ -117,7 +117,7 @@ class Dns public static function ipv6($hostname) { $records = dns_get_record($hostname, DNS_AAAA); - if ($records !== false && sizeof($records) > 0) { + if ($records !== false && count($records) > 0) { return $records[0]['ip']; } return false; diff --git a/modules/monitoring/application/views/scripts/list/servicematrix.phtml b/modules/monitoring/application/views/scripts/list/servicematrix.phtml index 9613112a2..b6fc35170 100644 --- a/modules/monitoring/application/views/scripts/list/servicematrix.phtml +++ b/modules/monitoring/application/views/scripts/list/servicematrix.phtml @@ -22,7 +22,7 @@ $pivotData = $this->pivot->toArray(); $hostFilter = '(' . implode('|', array_keys($pivotData)) . ')'; ?> - + translate('No Service Found'); ?>