index : flyspray | |
Archlinux32 customized Flyspray installation | gitolite user |
summaryrefslogtreecommitdiff |
author | Andreas Baumann <mail@andreasbaumann.cc> | 2020-02-01 09:05:48 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2020-02-01 09:05:48 +0100 |
commit | 6854cb3f4d8219cf1829e32122eb2502a916eae9 (patch) | |
tree | 350feb504587d932e02837a1442b059759927646 /vendor/league/oauth2-client/src/Entity/User.php |
-rw-r--r-- | vendor/league/oauth2-client/src/Entity/User.php | 117 |
diff --git a/vendor/league/oauth2-client/src/Entity/User.php b/vendor/league/oauth2-client/src/Entity/User.php new file mode 100644 index 0000000..756e09a --- /dev/null +++ b/vendor/league/oauth2-client/src/Entity/User.php @@ -0,0 +1,117 @@ +<?php + +namespace League\OAuth2\Client\Entity; + +class User +{ + protected $uid; + protected $nickname; + protected $name; + protected $firstName; + protected $lastName; + protected $email; + protected $location; + protected $description; + protected $imageUrl; + protected $urls; + protected $gender; + protected $locale; + + public function __get($name) + { + if (!property_exists($this, $name)) { + throw new \OutOfRangeException(sprintf( + '%s does not contain a property by the name of "%s"', + __CLASS__, + $name + )); + } + + return $this->{$name}; + } + + public function __set($property, $value) + { + if (!property_exists($this, $property)) { + throw new \OutOfRangeException(sprintf( + '%s does not contain a property by the name of "%s"', + __CLASS__, + $property + )); + } + + $this->$property = $value; + + return $this; + } + + public function __isset($name) + { + return (property_exists($this, $name)); + } + + public function getArrayCopy() + { + return [ + 'uid' => $this->uid, + 'nickname' => $this->nickname, + 'name' => $this->name, + 'firstName' => $this->firstName, + 'lastName' => $this->lastName, + 'email' => $this->email, + 'location' => $this->location, + 'description' => $this->description, + 'imageUrl' => $this->imageUrl, + 'urls' => $this->urls, + 'gender' => $this->gender, + 'locale' => $this->locale, + ]; + } + + public function exchangeArray(array $data) + { + foreach ($data as $key => $value) { + $key = strtolower($key); + switch ($key) { + case 'uid': + $this->uid = $value; + break; + case 'nickname': + $this->nickname = $value; + break; + case 'name': + $this->name = $value; + break; + case 'firstname': + $this->firstName = $value; + break; + case 'lastname': + $this->lastName = $value; + break; + case 'email': + $this->email = $value; + break; + case 'location': + $this->location = $value; + break; + case 'description': + $this->description = $value; + break; + case 'imageurl': + $this->imageUrl = $value; + break; + case 'urls': + $this->urls = $value; + break; + case 'gender': + $this->gender = $value; + break; + case 'locale': + $this->locale = $value; + break; + } + } + + return $this; + } +} |