Corrected magic getters and setters, removed unused iterator and provide fluent interface:
parent
7f7567cf92
commit
73f060a56d
|
@ -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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue