Code Duplication    Length = 12-12 lines in 2 locations

src/MiniProgram/MiniProgram.php 1 location

@@ 108-119 (lines=12) @@
105
     *
106
     * @throws InvalidArgumentException
107
     */
108
    public function __get($name)
109
    {
110
        if (property_exists($this, $name)) {
111
            return $this->$name;
112
        }
113
114
        if ($class = Arr::get($this->components, $name)) {
115
            return new $class($this->accessToken, $this->config);
116
        }
117
118
        throw new InvalidArgumentException("Property or component \"$name\" does not exists.");
119
    }
120
}
121

src/OpenPlatform/OpenPlatform.php 1 location

@@ 100-111 (lines=12) @@
97
     *
98
     * @throws \Exception
99
     */
100
    public function __get($name)
101
    {
102
        if (property_exists($this, $name)) {
103
            return $this->$name;
104
        }
105
106
        if ($class = Arr::get($this->components, $name)) {
107
            return new $class($this->access_token, $this->config);
108
        }
109
110
        throw new InvalidArgumentException("Property or component \"$name\" does not exists.");
111
    }
112
}
113