@@ 83-98 (lines=16) @@ | ||
80 | * |
|
81 | * @see \IPLib\Range\RangeInterface::contains() |
|
82 | */ |
|
83 | public function contains(AddressInterface $address) |
|
84 | { |
|
85 | $result = false; |
|
86 | if ($address->getAddressType() === $this->getAddressType()) { |
|
87 | $cmp = $address->getComparableString(); |
|
88 | $from = $this->getComparableStartString(); |
|
89 | if ($cmp >= $from) { |
|
90 | $to = $this->getComparableEndString(); |
|
91 | if ($cmp <= $to) { |
|
92 | $result = true; |
|
93 | } |
|
94 | } |
|
95 | } |
|
96 | ||
97 | return $result; |
|
98 | } |
|
99 | ||
100 | /** |
|
101 | * {@inheritdoc} |
|
@@ 105-121 (lines=17) @@ | ||
102 | * |
|
103 | * @see \IPLib\Range\RangeInterface::containsRange() |
|
104 | */ |
|
105 | public function containsRange(RangeInterface $range) |
|
106 | { |
|
107 | $result = false; |
|
108 | if ($range->getAddressType() === $this->getAddressType()) { |
|
109 | $myStart = $this->getComparableStartString(); |
|
110 | $itsStart = $range->getComparableStartString(); |
|
111 | if ($itsStart >= $myStart) { |
|
112 | $myEnd = $this->getComparableEndString(); |
|
113 | $itsEnd = $range->getComparableEndString(); |
|
114 | if ($itsEnd <= $myEnd) { |
|
115 | $result = true; |
|
116 | } |
|
117 | } |
|
118 | } |
|
119 | ||
120 | return $result; |
|
121 | } |
|
122 | } |
|
123 |