Conditions | 6 |
Paths | 5 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | public function __get($name) |
||
30 | { |
||
31 | if (!property_exists($this, $name)) { |
||
32 | if (array_key_exists($name, $this->instances)) { |
||
33 | return $this->instances[$name]; |
||
34 | } |
||
35 | |||
36 | if (property_exists($this, 'providers') && array_key_exists($name, $this->providers)) { |
||
37 | $advertiserId = $this->getAdvertiserId(); |
||
38 | $accessToken = $this->getAccessToken(); |
||
39 | $responseType = $this->getResponseType(); |
||
40 | |||
41 | return new $this->providers[$name]($advertiserId, $accessToken, $responseType); |
||
42 | } |
||
43 | |||
44 | if (method_exists($this, 'factory')) { |
||
45 | return $this->factory($name); |
||
46 | } |
||
47 | |||
48 | throw new Exception("Undefined property $name", 500); |
||
49 | } |
||
50 | |||
51 | return $this->$name; |
||
52 | } |
||
54 |