| 1 | <?php |
||
| 15 | abstract class Address implements AddressInterface |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var string |
||
| 19 | */ |
||
| 20 | protected $code; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | protected $name; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @var AddressInterface |
||
| 29 | */ |
||
| 30 | protected $parent; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * 子地区 |
||
| 34 | * @var AddressInterface[]|Collection |
||
| 35 | */ |
||
| 36 | protected $children; |
||
| 37 | |||
| 38 | public function __construct($code, $name, AddressInterface $parent = null) |
||
| 44 | |||
| 45 | /** |
||
| 46 | * {@inheritdoc} |
||
| 47 | */ |
||
| 48 | public function getName() |
||
| 52 | |||
| 53 | /** |
||
| 54 | * {@inheritdoc} |
||
| 55 | */ |
||
| 56 | public function getCode() |
||
| 60 | |||
| 61 | /** |
||
| 62 | * {@inheritdoc} |
||
| 63 | */ |
||
| 64 | public function __toString() |
||
| 68 | |||
| 69 | /** |
||
| 70 | * {@inheritdoc} |
||
| 71 | */ |
||
| 72 | public function setParent(AddressInterface $parent) |
||
| 76 | |||
| 77 | /** |
||
| 78 | * {@inheritdoc} |
||
| 79 | */ |
||
| 80 | public function getParent() |
||
| 84 | |||
| 85 | /** |
||
| 86 | * {@inheritdoc} |
||
| 87 | */ |
||
| 88 | public function setChildren($children) |
||
| 92 | |||
| 93 | /** |
||
| 94 | * {@inheritdoc} |
||
| 95 | */ |
||
| 96 | public function getChildren() |
||
| 100 | |||
| 101 | /** |
||
| 102 | * {@inheritdoc} |
||
| 103 | */ |
||
| 104 | public function jsonSerialize() |
||
| 113 | |||
| 114 | /** |
||
| 115 | * 获取当前类类型 |
||
| 116 | * @return string |
||
| 117 | */ |
||
| 118 | public static function getType() |
||
| 122 | } |