@@ 85-100 (lines=16) @@ | ||
82 | * |
|
83 | * @return Providers\ProviderInterface |
|
84 | */ |
|
85 | public function __get($key) |
|
86 | { |
|
87 | $key = strtolower($key); |
|
88 | ||
89 | if (isset($this->providers[$key])) { |
|
90 | return $this->providers[$key]; |
|
91 | } |
|
92 | ||
93 | $class = 'SocialLinks\\Providers\\'.ucfirst($key); |
|
94 | ||
95 | if (class_exists($class)) { |
|
96 | return $this->providers[$key] = new $class($this); |
|
97 | } |
|
98 | ||
99 | throw new \Exception("The provider $key does not exists"); |
|
100 | } |
|
101 | ||
102 | /** |
|
103 | * Magic method to instantiate and return metas in lazy mode. |
|
@@ 112-127 (lines=16) @@ | ||
109 | * |
|
110 | * @return Metas\MetaInterface |
|
111 | */ |
|
112 | public function __call($key, $arguments) |
|
113 | { |
|
114 | $key = strtolower($key); |
|
115 | ||
116 | if (isset($this->metas[$key])) { |
|
117 | return $this->metas[$key]; |
|
118 | } |
|
119 | ||
120 | $class = 'SocialLinks\\Metas\\'.ucfirst($key); |
|
121 | ||
122 | if (class_exists($class)) { |
|
123 | return $this->metas[$key] = new $class($this); |
|
124 | } |
|
125 | ||
126 | throw new \Exception("The meta $key does not exists"); |
|
127 | } |
|
128 | ||
129 | /** |
|
130 | * Preload the counter. |