| Conditions | 2 |
| Paths | 2 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | public function generateString($length) |
||
| 45 | { |
||
| 46 | //Create Binary String |
||
| 47 | $binaryString = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM); |
||
| 48 | |||
| 49 | //Unable to create binary string |
||
| 50 | if ($binaryString === false) { |
||
| 51 | throw new DropboxClientException( |
||
| 52 | static::ERROR_MESSAGE . |
||
| 53 | 'mcrypt_create_iv() returned an error.' |
||
| 54 | ); |
||
| 55 | } |
||
| 56 | |||
| 57 | //Convert binary to hex |
||
| 58 | return $this->binToHex($binaryString, $length); |
||
| 59 | } |
||
| 60 | } |
||
| 61 |