| 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 | * |
||
| 35 | * @var AddressInterface[]|Collection |
||
| 36 | */ |
||
| 37 | protected $children; |
||
| 38 | |||
| 39 | public function __construct($code, $name, AddressInterface $parent = null) |
||
| 45 | |||
| 46 | /** |
||
| 47 | * {@inheritdoc} |
||
| 48 | */ |
||
| 49 | public function getName() |
||
| 53 | |||
| 54 | /** |
||
| 55 | * {@inheritdoc} |
||
| 56 | */ |
||
| 57 | public function getCode() |
||
| 61 | |||
| 62 | /** |
||
| 63 | * {@inheritdoc} |
||
| 64 | */ |
||
| 65 | public function __toString() |
||
| 69 | |||
| 70 | /** |
||
| 71 | * {@inheritdoc} |
||
| 72 | */ |
||
| 73 | public function setParent(AddressInterface $parent) |
||
| 77 | |||
| 78 | /** |
||
| 79 | * {@inheritdoc} |
||
| 80 | */ |
||
| 81 | public function getParent() |
||
| 85 | |||
| 86 | /** |
||
| 87 | * {@inheritdoc} |
||
| 88 | */ |
||
| 89 | public function setChildren($children) |
||
| 93 | |||
| 94 | /** |
||
| 95 | * {@inheritdoc} |
||
| 96 | */ |
||
| 97 | public function getChildren() |
||
| 101 | |||
| 102 | /** |
||
| 103 | * {@inheritdoc} |
||
| 104 | */ |
||
| 105 | public function jsonSerialize() |
||
| 114 | |||
| 115 | /** |
||
| 116 | * 获取当前类类型. |
||
| 117 | * |
||
| 118 | * @return string |
||
| 119 | */ |
||
| 120 | public static function getType() |
||
| 124 | } |