Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Lines | 3 |
Ratio | 18.75 % |
Tests | 9 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
27 | 8 | public function __construct($uid_bitmap_length) |
|
28 | { |
||
29 | 8 | if (!is_int($uid_bitmap_length)) { |
|
30 | 1 | throw new ArgumentTypeException(sprintf('Length of bitmap for UID should be integer, got "%s" instead.', gettype($uid_bitmap_length))); |
|
31 | } |
||
32 | |||
33 | 7 | if ($uid_bitmap_length <= 0) { |
|
34 | 2 | throw new ZeroArgumentException(sprintf('Length of bitmap for UID should be grate then "0", got "%d" instead.', $uid_bitmap_length)); |
|
35 | } |
||
36 | |||
37 | 5 | View Code Duplication | if ($uid_bitmap_length >= PHP_INT_SIZE * 8) { |
|
|||
38 | 1 | throw new ProcessorArchitectureException(sprintf('Your processor architecture support %d-bit mode, got "%d" instead.', PHP_INT_SIZE * 8, $uid_bitmap_length)); |
|
39 | } |
||
40 | |||
41 | 4 | $this->uid_bitmap_length = $uid_bitmap_length; |
|
42 | 4 | } |
|
43 | |||
59 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.