-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6b0b31
commit 3397515
Showing
1 changed file
with
24 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,26 @@ | ||
# ensostudio/comparator | ||
|
||
Package to comparing any values. | ||
|
||
# Installation | ||
|
||
The flexible comparation of any values. | ||
### Installation | ||
Via Composer: | ||
```bash | ||
~~~bash | ||
composer require ensostudio/comparator | ||
``` | ||
~~~ | ||
### API | ||
~~~php | ||
namespace EnsoStudio\Comparator; | ||
class Comparator | ||
{ | ||
public function __construct(int $flags); | ||
public function setFlags(int $flags); | ||
public function getFlags(): int; | ||
public function hasFlag(int $flag): bool; | ||
public function compare(mixed $value, mixed $value): bool; | ||
} | ||
~~~ | ||
### Usage | ||
~~~php | ||
use EnsoStudio\Comparator\Comparator; | ||
$comparator = new Comparator(Comparator::EQUAL_ARRAY | Comparator::EQUAL_FLOAT); | ||
if ($comparator->compare(['float' => 2 - 1.6, 'int' => 3], ['int' => 3, 'float' => 0.4])) { | ||
echo 'equal values'; | ||
} | ||
~~~ |