@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | * @param string $symbols |
| 21 | 21 | * @param int $priority |
| 22 | 22 | */ |
| 23 | - public function __construct ( $symbols, $priority = 100 ) |
|
| 23 | + public function __construct($symbols, $priority = 100) |
|
| 24 | 24 | { |
| 25 | - $this->setSymbols( $symbols ); |
|
| 26 | - $this->setPriority( $priority ); |
|
| 25 | + $this->setSymbols($symbols); |
|
| 26 | + $this->setPriority($priority); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @throws InvalidArgumentException |
| 35 | 35 | */ |
| 36 | - protected function setSymbols ( $symbols ) |
|
| 36 | + protected function setSymbols($symbols) |
|
| 37 | 37 | { |
| 38 | - if ( is_string( $symbols ) && strlen( $symbols ) > 0 ) { |
|
| 38 | + if (is_string($symbols) && strlen($symbols) > 0) { |
|
| 39 | 39 | $this->symbols = $symbols; |
| 40 | 40 | return true; |
| 41 | 41 | } |
| 42 | - throw new InvalidArgumentException( 'Symbols must be a string, and contain at least one character' ); |
|
| 42 | + throw new InvalidArgumentException('Symbols must be a string, and contain at least one character'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -49,19 +49,19 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @throws InvalidArgumentException |
| 51 | 51 | */ |
| 52 | - protected function setPriority ( $priority ) |
|
| 52 | + protected function setPriority($priority) |
|
| 53 | 53 | { |
| 54 | - if ( is_int( $priority ) && $priority > 0 && $priority <= 100 ) { |
|
| 54 | + if (is_int($priority) && $priority > 0 && $priority <= 100) { |
|
| 55 | 55 | $this->priority = $priority; |
| 56 | 56 | return true; |
| 57 | 57 | } |
| 58 | - throw new InvalidArgumentException( 'Priority must be interger and in the range from 1 to 100' ); |
|
| 58 | + throw new InvalidArgumentException('Priority must be interger and in the range from 1 to 100'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | 62 | * @return int |
| 63 | 63 | */ |
| 64 | - public function getPriority () |
|
| 64 | + public function getPriority() |
|
| 65 | 65 | { |
| 66 | 66 | return $this->priority; |
| 67 | 67 | } |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | /** |
| 70 | 70 | * @return string |
| 71 | 71 | */ |
| 72 | - public function getRandomSymbol () |
|
| 72 | + public function getRandomSymbol() |
|
| 73 | 73 | { |
| 74 | - $length = strlen( $this->symbols ); |
|
| 75 | - $position = mt_rand( 0, $length - 1 ); |
|
| 76 | - return $this->symbols[ $position ]; |
|
| 74 | + $length = strlen($this->symbols); |
|
| 75 | + $position = mt_rand(0, $length - 1); |
|
| 76 | + return $this->symbols[$position]; |
|
| 77 | 77 | } |
| 78 | 78 | } |