| Conditions | 3 |
| Paths | 4 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public static function get_random_string( $length = 15, $length_max = null ) { |
||
| 26 | // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_rand |
||
| 27 | $length = $length_max ? rand( $length, $length_max ) : $length; |
||
| 28 | |||
| 29 | $char_length = strlen( self::CHARS ); |
||
| 30 | |||
| 31 | for ( $string = '', $i = 0; $i < $length; $i++ ) { |
||
| 32 | // phpcs:ignore WordPress.WP.AlternativeFunctions.rand_rand |
||
| 33 | $string .= self::CHARS[ rand( 0, $char_length - 1 ) ]; |
||
| 34 | } |
||
| 35 | |||
| 36 | return $string; |
||
| 37 | } |
||
| 38 | |||
| 40 |