@@ -378,6 +378,29 @@ public function isThirteen(): bool
378
378
return $ this ->isEqual ('13 ' );
379
379
}
380
380
381
+ /**
382
+ * Returns boolean if the current value is equal to the given value.
383
+ *
384
+ * @param AbstractNumber|string|float|int $value
385
+ */
386
+ public function isEqual ($ value , int $ scale = null ): bool
387
+ {
388
+ $ number = $ this ->getNumberFromInput ($ value );
389
+ $ scale = $ scale ?? self ::INTERNAL_SCALE ;
390
+
391
+ return bccomp ($ this ->value , $ number ->get (), $ scale ) === 0 ;
392
+ }
393
+
394
+ /**
395
+ * Alias for isEqual method.
396
+ *
397
+ * @param AbstractNumber|string|float|int $value
398
+ */
399
+ public function eq ($ value , int $ scale = null ): bool
400
+ {
401
+ return $ this ->isEqual ($ value , $ scale );
402
+ }
403
+
381
404
/**
382
405
* Returns boolean if the current value is greater than the given value.
383
406
*
@@ -391,6 +414,36 @@ public function isGreaterThan($value, int $scale = null): bool
391
414
return bccomp ($ this ->value , $ number ->get (), $ scale ) === 1 ;
392
415
}
393
416
417
+ /**
418
+ * Alias for isGreaterThan method.
419
+ *
420
+ * @param AbstractNumber|string|float|int $value
421
+ */
422
+ public function gt ($ value , int $ scale = null ): bool
423
+ {
424
+ return $ this ->isGreaterThan ($ value , $ scale );
425
+ }
426
+
427
+ /**
428
+ * Returns boolean if the current value is greater than or equal to the given value.
429
+ *
430
+ * @param AbstractNumber|string|float|int $value
431
+ */
432
+ public function isGreaterThanOrEqual ($ value , int $ scale = null ): bool
433
+ {
434
+ return $ this ->isGreaterThan ($ value , $ scale ) || $ this ->isEqual ($ value , $ scale );
435
+ }
436
+
437
+ /**
438
+ * Alias for isGreaterThanOrEqual method.
439
+ *
440
+ * @param AbstractNumber|string|float|int $value
441
+ */
442
+ public function gte ($ value , int $ scale = null ): bool
443
+ {
444
+ return $ this ->isGreaterThanOrEqual ($ value , $ scale );
445
+ }
446
+
394
447
/**
395
448
* Returns boolean if the current value is less than the given value.
396
449
*
@@ -405,16 +458,33 @@ public function isLessThan($value, int $scale = null): bool
405
458
}
406
459
407
460
/**
408
- * Returns boolean if the current value is equal to the given value .
461
+ * Alias for isLessThan method .
409
462
*
410
463
* @param AbstractNumber|string|float|int $value
411
464
*/
412
- public function isEqual ($ value , int $ scale = null ): bool
465
+ public function lt ($ value , int $ scale = null ): bool
413
466
{
414
- $ number = $ this ->getNumberFromInput ($ value );
415
- $ scale = $ scale ?? self :: INTERNAL_SCALE ;
467
+ return $ this ->isLessThan ($ value, $ scale );
468
+ }
416
469
417
- return bccomp ($ this ->value , $ number ->get (), $ scale ) === 0 ;
470
+ /**
471
+ * Returns boolean if the current value is less than or equal to the given value.
472
+ *
473
+ * @param AbstractNumber|string|float|int $value
474
+ */
475
+ public function isLessThanOrEqual ($ value , int $ scale = null ): bool
476
+ {
477
+ return $ this ->isLessThan ($ value , $ scale ) || $ this ->isEqual ($ value , $ scale );
478
+ }
479
+
480
+ /**
481
+ * Alias for isGreaterThanOrEqual method.
482
+ *
483
+ * @param AbstractNumber|string|float|int $value
484
+ */
485
+ public function lte ($ value , int $ scale = null ): bool
486
+ {
487
+ return $ this ->isLessThanOrEqual ($ value , $ scale );
418
488
}
419
489
420
490
/**
0 commit comments