Numbers   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 4
c 1
b 0
f 1
dl 0
loc 15
ccs 3
cts 3
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isInRange() 0 2 2
A range() 0 2 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Utils;
5
6
/**
7
 * Numbers
8
 *
9
 * @author Jakub Konečný
10
 */
11 1
final class Numbers {
12
  use \Nette\StaticClass;
13
  
14
  /**
15
   * Ensure that a number is within boundaries
16
   */
17
  public static function range(int $number, int $min, int $max): int {
18 1
    return min(max($number, $min), $max);
19
  }
20
  
21
  /**
22
   * Check whether a number is within boundaries
23
   */
24
  public static function isInRange(int $number, int $min, int $max): bool {
25 1
    return ($number >= $min && $number <= $max);
26
  }
27
}
28
?>