1 | <?php |
||
21 | class ZoneBuilder |
||
22 | { |
||
23 | /** |
||
24 | * @param Zone $zone |
||
25 | * |
||
26 | * @return string |
||
27 | */ |
||
28 | 3 | public static function build(Zone $zone): string |
|
55 | |||
56 | /** |
||
57 | * Fills out all of the data of each resource record. The function will add the parent domain to all non-qualified |
||
58 | * sub-domains, replace '@' with the zone name, ensure the class and TTL are on each record. |
||
59 | * |
||
60 | * @param Zone $zone |
||
61 | */ |
||
62 | 1 | public static function fillOutZone(Zone $zone) |
|
74 | |||
75 | /** |
||
76 | * Add the parent domain to the sub-domain if the sub-domain if it is not fully qualified. |
||
77 | * |
||
78 | * @param string|null $subDomain |
||
79 | * @param string $parent |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | 1 | private static function fullyQualify(?string $subDomain, string $parent): string |
|
95 | |||
96 | /** |
||
97 | * @param RdataInterface $rdata |
||
98 | * @param Zone $zone |
||
99 | */ |
||
100 | 1 | private static function fillOutRdata(RdataInterface $rdata, Zone $zone): void |
|
119 | |||
120 | /** |
||
121 | * @param SOA $rdata |
||
122 | * @param Zone $zone |
||
123 | */ |
||
124 | 1 | private static function fillOutSoa(SOA $rdata, Zone $zone): void |
|
129 | |||
130 | /** |
||
131 | * @param CNAME $rdata |
||
132 | * @param Zone $zone |
||
133 | */ |
||
134 | 1 | private static function fillOutCname(Cname $rdata, Zone $zone): void |
|
138 | |||
139 | /** |
||
140 | * @param MX $rdata |
||
141 | * @param Zone $zone |
||
142 | */ |
||
143 | 1 | private static function fillOutMx(MX $rdata, Zone $zone): void |
|
147 | |||
148 | /** |
||
149 | * @param AAAA $rdata |
||
150 | * @param Zone $zone |
||
151 | */ |
||
152 | 1 | private static function fillOutAaaa(AAAA $rdata, Zone $zone): void |
|
156 | } |
||
157 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: