Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/vendor/league/oauth2-client/src/Entity/User.php
blob: 756e09a8428435240fe3a1fb74b4b4f5e4a06bdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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;
    }
}