@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | public static function checkFieldForRandom($model, string $field, string $type = 'str', int $length = 8) |
| 13 | 13 | { |
| 14 | - if($type == 'str') { |
|
| 14 | + if ($type == 'str') { |
|
| 15 | 15 | $rnd = self::randomStr($length); |
| 16 | - } else if($type == 'int') { |
|
| 16 | + } else if ($type == 'int') { |
|
| 17 | 17 | $rnd = self::randomInt($length); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -46,22 +46,22 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | private static function randomInt($length = 4) |
| 48 | 48 | { |
| 49 | - $rand = ''; |
|
| 50 | - while( !( isset( $rand[$length-1] ) ) ) { |
|
| 51 | - $rand .= mt_rand( ); |
|
| 49 | + $rand = ''; |
|
| 50 | + while (!(isset($rand[$length - 1]))) { |
|
| 51 | + $rand .= mt_rand( ); |
|
| 52 | 52 | } |
| 53 | - return (int)substr( $rand , 0 , $length ); |
|
| 53 | + return (int)substr($rand, 0, $length); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public static function decimalToTime($decimal) |
| 57 | 57 | { |
| 58 | - if(!$decimal) { |
|
| 58 | + if (!$decimal) { |
|
| 59 | 59 | return "Empty data given."; |
| 60 | 60 | } |
| 61 | - if (strpos((string) $decimal, ".") !== false) { |
|
| 61 | + if (strpos((string)$decimal, ".") !== false) { |
|
| 62 | 62 | $timeArray = explode(".", $decimal); |
| 63 | - if(isset($timeArray[1])) { |
|
| 64 | - if(strlen((string) $timeArray[1]) == 1) { |
|
| 63 | + if (isset($timeArray[1])) { |
|
| 64 | + if (strlen((string)$timeArray[1]) == 1) { |
|
| 65 | 65 | $timeArray[1] = sprintf("%1s0", $timeArray[1]); |
| 66 | 66 | return gmdate('H:i:s', $timeArray[0]).'.'.$timeArray[1]; |
| 67 | 67 | } |