From 33975158cfe7dfd145cc107649dc49e6034d8ee5 Mon Sep 17 00:00:00 2001 From: Anton Fedonyuk Date: Tue, 12 Apr 2022 09:42:21 +0300 Subject: [PATCH] Update README.md --- README.md | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0d78628..2bc416c 100644 --- a/README.md +++ b/README.md @@ -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 -``` \ No newline at end of file +~~~ +### 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'; +} +~~~