PluginProbe
Metricool – Social media and site statistics / 2.1.1
Metricool – Social media and site statistics v2.1.1
2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.27 trunk
metricool / app / Http / Metricool / DTOs / DTO.php

DTO.php in Metricool – Social media and site statistics 2.1.1, at app/Http/Metricool/DTOs/DTO.php

29 lines 606 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Metricool\Http\Metricool\DTOs;
6
7 /**
8 * DTO class to store arrays into an object
9 * Dynamically access properties through magic method.
10 * You can define an accessor with (for example) getCountryAttribute()
11 * $dto->country will call the getCountryAttribute accessor method
12 */
13 abstract class DTO
14 {
15 /**
16 * @return null|mixed
17 */
18 public function __get(string $key)
19 {
20 $method = 'get' . ucfirst($key) . 'Attribute';
21
22 if (method_exists($this, $method)) {
23 return $this->$method();
24 }
25
26 return null;
27 }
28 }
29