From 73f060a56de5a66c2211c5fa5430ca250b997fed Mon Sep 17 00:00:00 2001 From: Tom Anderson Date: Fri, 25 Apr 2014 10:47:44 -0700 Subject: [PATCH] Corrected magic getters and setters, removed unused iterator and provide fluent interface: --- src/Provider/User.php | 44 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/src/Provider/User.php b/src/Provider/User.php index aa77fdd..af5da1f 100644 --- a/src/Provider/User.php +++ b/src/Provider/User.php @@ -2,38 +2,30 @@ namespace League\OAuth2\Client\Provider; -class User implements \IteratorAggregate +class User { - public $uid; - public $nickname; - public $name; - public $firstName; - public $lastName; - public $email; - public $location; - public $description; - public $imageUrl; - public $urls; + protected $uid; + protected $nickname; + protected $name; + protected $firstName; + protected $lastName; + protected $email; + protected $location; + protected $description; + protected $imageUrl; + protected $urls; - public function __set($name, $value) - { - if (isset($this->{$name})) { - $this->{$name} = $value; + public function __get($property) { + if (property_exists($this, $property)) { + return $this->$property; } } - public function __get($name) - { - if (isset($this->{$name})) { - return $this->{$name}; - } else { - return null; + public function __set($property, $value) { + if (property_exists($this, $property)) { + $this->$property = $value; } - } - public function getIterator() - { - return new \ArrayIterator($this); + return $this; } - }