Corrected magic getters and setters, removed unused iterator and provide fluent interface:

1.0
Tom Anderson 2014-04-25 10:47:44 -07:00
parent 7f7567cf92
commit 73f060a56d
1 changed files with 18 additions and 26 deletions

View File

@ -2,38 +2,30 @@
namespace League\OAuth2\Client\Provider; namespace League\OAuth2\Client\Provider;
class User implements \IteratorAggregate class User
{ {
public $uid; protected $uid;
public $nickname; protected $nickname;
public $name; protected $name;
public $firstName; protected $firstName;
public $lastName; protected $lastName;
public $email; protected $email;
public $location; protected $location;
public $description; protected $description;
public $imageUrl; protected $imageUrl;
public $urls; protected $urls;
public function __set($name, $value) public function __get($property) {
{ if (property_exists($this, $property)) {
if (isset($this->{$name})) { return $this->$property;
$this->{$name} = $value;
} }
} }
public function __get($name) public function __set($property, $value) {
{ if (property_exists($this, $property)) {
if (isset($this->{$name})) { $this->$property = $value;
return $this->{$name};
} else {
return null;
} }
}
public function getIterator() return $this;
{
return new \ArrayIterator($this);
} }
} }