@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | * @param int $length |
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | - public static function generateCustom($prefix, $length=128) { |
|
| 32 | + public static function generateCustom($prefix, $length = 128) { |
|
| 33 | 33 | |
| 34 | - if ( $length <= (strlen($prefix)+1) ) { |
|
| 34 | + if ( $length <= (strlen($prefix) + 1) ) { |
|
| 35 | 35 | throw new InvalidArgumentException("Uid length cannot be smaller than prefix length +1"); |
| 36 | 36 | |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - return "$prefix-".self::generate($length-(strlen($prefix)+1)); |
|
| 39 | + return "$prefix-".self::generate($length - (strlen($prefix) + 1)); |
|
| 40 | 40 | |
| 41 | 41 | } |
| 42 | 42 | |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | * @param int $length |
| 47 | 47 | * @return string |
| 48 | 48 | */ |
| 49 | - public static function generate($length=128) { |
|
| 49 | + public static function generate($length = 128) { |
|
| 50 | 50 | |
| 51 | - if ($length < 32) { |
|
| 51 | + if ( $length < 32 ) { |
|
| 52 | 52 | |
| 53 | 53 | return substr(self::getUid(), 0, $length); |
| 54 | 54 | |
| 55 | - } else if ($length == 32) { |
|
| 55 | + } else if ( $length == 32 ) { |
|
| 56 | 56 | |
| 57 | 57 | return self::getUid(); |
| 58 | 58 | |
| 59 | - } else { |
|
| 59 | + } else { |
|
| 60 | 60 | |
| 61 | - $numString = (int)($length/32) + 1; |
|
| 61 | + $numString = (int) ($length / 32) + 1; |
|
| 62 | 62 | $randNum = ""; |
| 63 | - for ($i = 0; $i < $numString; $i++) $randNum .= self::getUid(); |
|
| 63 | + for ( $i = 0; $i < $numString; $i++ ) $randNum .= self::getUid(); |
|
| 64 | 64 | |
| 65 | 65 | return substr($randNum, 0, $length); |
| 66 | 66 | |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | |
| 57 | 57 | return self::getUid(); |
| 58 | 58 | |
| 59 | - } else { |
|
| 59 | + } else { |
|
| 60 | 60 | |
| 61 | 61 | $numString = (int)($length/32) + 1; |
| 62 | 62 | $randNum = ""; |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | * @param int $default Default value |
| 30 | 30 | * @return int |
| 31 | 31 | */ |
| 32 | - public static function filterInteger($int, $min=~PHP_INT_MAX, $max=PHP_INT_MAX, $default=0) { |
|
| 32 | + public static function filterInteger($int, $min = ~PHP_INT_MAX, $max = PHP_INT_MAX, $default = 0) { |
|
| 33 | 33 | |
| 34 | 34 | return filter_var($int, FILTER_VALIDATE_INT, array( |
| 35 | 35 | 'options' => array( |