@@ -140,7 +140,6 @@ will return:
140
140
<a href =" #col " >col</a >
141
141
<a href =" #collapse " >collapse</a >
142
142
<a href =" #combine " >combine</a >
143
- <a href =" #compare " >compare</a >
144
143
<a href =" #concat " >concat</a >
145
144
<a href =" #contains " >contains</a >
146
145
<a href =" #copy " >copy</a >
@@ -257,6 +256,7 @@ will return:
257
256
<a href =" #splice " >splice</a >
258
257
<a href =" #strafter " >strAfter</a >
259
258
<a href =" #strbefore " >strBefore</a >
259
+ <a href =" #strcompare " >strCompare</a >
260
260
<a href =" #strcontains " >strContains</a >
261
261
<a href =" #strcontainsall " >strContainsAll</a >
262
262
<a href =" #strends " >strEnds</a >
@@ -436,7 +436,6 @@ will return:
436
436
437
437
* [ function is_map()] ( #is_map-function ) : Tests if the variable is a map object
438
438
* [ any()] ( #any ) : Tests if at least one element satisfies the callback function
439
- * [ compare()] ( #compare ) : Compares the value against all map elements
440
439
* [ contains()] ( #contains ) : Tests if an item exists in the map
441
440
* [ each()] ( #each ) : Applies a callback to each element
442
441
* [ empty()] ( #empty ) : Tests if map is empty
@@ -459,6 +458,7 @@ will return:
459
458
* [ implements()] ( #implements ) : Tests if all entries are objects implementing the interface
460
459
* [ none()] ( #none ) : Tests if none of the elements are part of the map
461
460
* [ some()] ( #some ) : Tests if at least one element is included
461
+ * [ strCompare()] ( #strcompare ) : Compares the value against all map elements
462
462
* [ strContains()] ( #strcontains ) : Tests if at least one of the passed strings is part of at least one entry
463
463
* [ strContainsAll()] ( #strcontainsall ) : Tests if all of the entries contains one of the passed strings
464
464
* [ strEnds()] ( #strends ) : Tests if at least one of the entries ends with one of the passed strings
@@ -1440,53 +1440,6 @@ Map::from( ['name', 'age'] )->combine( ['Tom', 29] );
1440
1440
* [ zip()] ( #zip ) - Merges the values of all arrays at the corresponding index
1441
1441
1442
1442
1443
- ### compare()
1444
-
1445
- Compares the value against all map elements.
1446
-
1447
- ``` php
1448
- public function compare( string $value, bool $case = true ) : bool
1449
- ```
1450
-
1451
- * @param ** string** ` $value ` Value to compare map elements to
1452
- * @param ** bool** ` $case ` TRUE if comparison is case sensitive, FALSE to ignore upper/lower case
1453
- * @return ** bool** TRUE If at least one element matches, FALSE if value is not in map
1454
-
1455
- All scalar values (bool, float, int and string) are casted to string values before
1456
- comparing to the given value. Non-scalar values in the map are ignored.
1457
-
1458
- ** Examples:**
1459
-
1460
- ``` php
1461
- Map::from( ['foo', 'bar'] )->compare( 'foo' );
1462
- // true
1463
-
1464
- Map::from( ['foo', 'bar'] )->compare( 'Foo', false );
1465
- // true (case insensitive)
1466
-
1467
- Map::from( [123, 12.3] )->compare( '12.3' );
1468
- // true
1469
-
1470
- Map::from( [false, true] )->compare( '1' );
1471
- // true
1472
-
1473
- Map::from( ['foo', 'bar'] )->compare( 'Foo' );
1474
- // false (case sensitive)
1475
-
1476
- Map::from( ['foo', 'bar'] )->compare( 'baz' );
1477
- // false
1478
-
1479
- Map::from( [new \stdClass(), 'bar'] )->compare( 'foo' );
1480
- // false
1481
- ```
1482
-
1483
- ** See also:**
1484
-
1485
- * [ contains()] ( #contains ) - Tests if an item exists in the map
1486
- * [ in()] ( #in ) - Tests if element is included
1487
- * [ includes()] ( #includes ) - Tests if element is included
1488
-
1489
-
1490
1443
### concat()
1491
1444
1492
1445
Pushs all of the given elements onto the map without creating a new map.
@@ -5659,6 +5612,53 @@ Map::from( [0, 0.0, false, []] )->strBefore( '' );
5659
5612
* [ strAfter()] ( #strafter ) - Returns the strings after the passed value
5660
5613
5661
5614
5615
+ ### strCompare()
5616
+
5617
+ Compares the value against all map elements.
5618
+
5619
+ ``` php
5620
+ public function strCompare( string $value, bool $case = true ) : bool
5621
+ ```
5622
+
5623
+ * @param ** string** ` $value ` Value to compare map elements to
5624
+ * @param ** bool** ` $case ` TRUE if comparison is case sensitive, FALSE to ignore upper/lower case
5625
+ * @return ** bool** TRUE If at least one element matches, FALSE if value is not in map
5626
+
5627
+ All scalar values (bool, float, int and string) are casted to string values before
5628
+ comparing to the given value. Non-scalar values in the map are ignored.
5629
+
5630
+ ** Examples:**
5631
+
5632
+ ``` php
5633
+ Map::from( ['foo', 'bar'] )->strCompare( 'foo' );
5634
+ // true
5635
+
5636
+ Map::from( ['foo', 'bar'] )->strCompare( 'Foo', false );
5637
+ // true (case insensitive)
5638
+
5639
+ Map::from( [123, 12.3] )->strCompare( '12.3' );
5640
+ // true
5641
+
5642
+ Map::from( [false, true] )->strCompare( '1' );
5643
+ // true
5644
+
5645
+ Map::from( ['foo', 'bar'] )->strCompare( 'Foo' );
5646
+ // false (case sensitive)
5647
+
5648
+ Map::from( ['foo', 'bar'] )->strCompare( 'baz' );
5649
+ // false
5650
+
5651
+ Map::from( [new \stdClass(), 'bar'] )->strCompare( 'foo' );
5652
+ // false
5653
+ ```
5654
+
5655
+ ** See also:**
5656
+
5657
+ * [ contains()] ( #contains ) - Tests if an item exists in the map
5658
+ * [ in()] ( #in ) - Tests if element is included
5659
+ * [ includes()] ( #includes ) - Tests if element is included
5660
+
5661
+
5662
5662
### strContains()
5663
5663
5664
5664
Tests if at least one of the passed strings is part of at least one entry.
0 commit comments