@@ -54,7 +54,7 @@ class TreeMap extends AbstractMap
5454 *
5555 * @since 1.0.0
5656 */
57- private $ comparator ;
57+ private $ comparatorInternal ;
5858
5959 /**
6060 * Constructor
@@ -66,11 +66,11 @@ class TreeMap extends AbstractMap
6666 protected function __construct ($ comparator = null )
6767 {
6868 if ($ comparator === null ) {
69- $ this ->comparator = function ($ key1 , $ key2 ) {
69+ $ this ->comparatorInternal = function ($ key1 , $ key2 ) {
7070 return $ key1 <=> $ key2 ;
7171 };
7272 } else {
73- $ this ->comparator = $ comparator ;
73+ $ this ->comparatorInternal = $ comparator ;
7474 }
7575 }
7676
@@ -97,7 +97,7 @@ public static function create($comparator = null)
9797 */
9898 public function comparator ()
9999 {
100- return $ this ->comparator ;
100+ return $ this ->comparatorInternal ;
101101 }
102102
103103 /**
@@ -194,7 +194,7 @@ public function successor($element)
194194 public function lower ($ key )
195195 {
196196 if ($ this ->root ) {
197- $ lower = $ this ->root ->find ($ key , $ this ->comparator , -2 );
197+ $ lower = $ this ->root ->find ($ key , $ this ->comparatorInternal , -2 );
198198 } else {
199199 $ lower = null ;
200200 }
@@ -220,7 +220,7 @@ public function lower($key)
220220 public function floor ($ key )
221221 {
222222 if ($ this ->root ) {
223- $ floor = $ this ->root ->find ($ key , $ this ->comparator , -1 );
223+ $ floor = $ this ->root ->find ($ key , $ this ->comparatorInternal , -1 );
224224 } else {
225225 $ floor = null ;
226226 }
@@ -246,7 +246,7 @@ public function floor($key)
246246 public function find ($ key )
247247 {
248248 if ($ this ->root ) {
249- $ find = $ this ->root ->find ($ key , $ this ->comparator , 0 );
249+ $ find = $ this ->root ->find ($ key , $ this ->comparatorInternal , 0 );
250250 } else {
251251 $ find = null ;
252252 }
@@ -272,7 +272,7 @@ public function find($key)
272272 public function ceiling ($ key )
273273 {
274274 if ($ this ->root ) {
275- $ ceiling = $ this ->root ->find ($ key , $ this ->comparator , 1 );
275+ $ ceiling = $ this ->root ->find ($ key , $ this ->comparatorInternal , 1 );
276276 } else {
277277 $ ceiling = null ;
278278 }
@@ -298,7 +298,7 @@ public function ceiling($key)
298298 public function higher ($ key )
299299 {
300300 if ($ this ->root ) {
301- $ higher = $ this ->root ->find ($ key , $ this ->comparator , 2 );
301+ $ higher = $ this ->root ->find ($ key , $ this ->comparatorInternal , 2 );
302302 } else {
303303 $ higher = null ;
304304 }
@@ -408,7 +408,7 @@ public function jsonSerialize(): array
408408 public function offsetSet ($ key , $ value ): void
409409 {
410410 if ($ this ->root ) {
411- $ this ->root = $ this ->root ->insert ($ key , $ value , $ this ->comparator );
411+ $ this ->root = $ this ->root ->insert ($ key , $ value , $ this ->comparatorInternal );
412412 } else {
413413 $ this ->root = TreeNode::create ($ key , $ value );
414414 }
@@ -426,7 +426,7 @@ public function offsetSet($key, $value): void
426426 public function offsetUnset ($ key ): void
427427 {
428428 if ($ this ->root ) {
429- $ this ->root = $ this ->root ->remove ($ key , $ this ->comparator );
429+ $ this ->root = $ this ->root ->remove ($ key , $ this ->comparatorInternal );
430430 }
431431 }
432432
0 commit comments