From 42522e2123d8092f2351bf03086024e6b6bb6ba8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Sun, 28 Feb 2010 14:17:44 +0100 Subject: [PATCH] Fixes the function that returns int in PlDict, adds count and merge to PlDict. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/pldict.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/classes/pldict.php b/classes/pldict.php index a704cff..b67095a 100644 --- a/classes/pldict.php +++ b/classes/pldict.php @@ -80,7 +80,7 @@ class PlDict public function i($key, $default = 0) { $i = $this->_get($key, $default); - return ctype_digit($i) ? intval($i) : $default; + return (is_int($i) || ctype_digit($i)) ? intval($i) : $default; } public function l(array $keys) @@ -92,6 +92,16 @@ class PlDict { return $this->array; } + + public function count() + { + return count($this->array); + } + + public function merge(array $array) + { + $this->array = array_merge($this->array, $array); + } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: -- 2.1.4