Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]
1 <?php 2 3 declare(strict_types=1); 4 5 namespace GeoIp2\Model; 6 7 /** 8 * @ignore 9 */ 10 abstract class AbstractModel implements \JsonSerializable 11 { 12 /** 13 * @var array<string, mixed> 14 */ 15 protected $raw; 16 17 /** 18 * @ignore 19 */ 20 public function __construct(array $raw) 21 { 22 $this->raw = $raw; 23 } 24 25 /** 26 * @ignore 27 * 28 * @return mixed 29 */ 30 protected function get(string $field) 31 { 32 if (isset($this->raw[$field])) { 33 return $this->raw[$field]; 34 } 35 if (preg_match('/^is_/', $field)) { 36 return false; 37 } 38 39 return null; 40 } 41 42 /** 43 * @ignore 44 * 45 * @return mixed 46 */ 47 public function __get(string $attr) 48 { 49 if ($attr !== 'instance' && property_exists($this, $attr)) { 50 return $this->{$attr}; 51 } 52 53 throw new \RuntimeException("Unknown attribute: $attr"); 54 } 55 56 /** 57 * @ignore 58 */ 59 public function __isset(string $attr): bool 60 { 61 return $attr !== 'instance' && isset($this->{$attr}); 62 } 63 64 public function jsonSerialize(): array 65 { 66 return $this->raw; 67 } 68 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body