From 0aa02975462aeed0fbe7c25dc1388e5f1c175bc0 Mon Sep 17 00:00:00 2001 From: Olivier Laviale Date: Wed, 9 Apr 2014 20:11:20 +0200 Subject: [PATCH] Added the 'name' property. --- lib/timezone.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) mode change 100644 => 100755 lib/timezone.php diff --git a/lib/timezone.php b/lib/timezone.php old mode 100644 new mode 100755 index c306a34..03a2923 --- a/lib/timezone.php +++ b/lib/timezone.php @@ -69,6 +69,15 @@ static public function from($source) return self::$cache[$source]; } + /** + * The name of the timezone. + * + * Note: This variable is only used to provide information during debugging. + * + * @var string + */ + private $name; + /** * Location of the timezone. * @@ -76,6 +85,18 @@ static public function from($source) */ private $location; + /** + * Initializes the {@link $name} property. + * + * @param string $timezone + */ + public function __construct($timezone) + { + parent::__construct($timezone); + + $this->name = $this->getName(); + } + /** * Returns the {@link $location}, {@link $name} and {@link $offset} properties. * @@ -96,7 +117,7 @@ public function __get($property) case 'name': - return $this->getName(); + return $this->name; case 'offset': @@ -127,6 +148,6 @@ public function __get($property) */ public function __toString() { - return $this->getName(); + return $this->name; } } \ No newline at end of file