Skip to content

Commit

Permalink
#2 fix typo method name getCaractersForRandomString
Browse files Browse the repository at this point in the history
  • Loading branch information
rancoud committed May 9, 2020
1 parent d6ec5f0 commit 3d78528
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ Crypt::useBcrypt();

## Crypt
### Static Methods
* getCaractersForRandomString(): string
* getCharactersForRandomString(): string
* getCurrentAlgo(): int
* getOptionsArgon2i(): array
* getOptionsBcrypt(): array
* getRandomString([length: int = 64]): string
* hash(password: string): string
* needsRehash(hash: string): bool
* setCaractersForRandomString(caracters: string): void
* setCharactersForRandomString(characters: string): void
* setOptionArgon2iMemoryCost(bytes: int): void
* setOptionArgon2iThreads(threads: int): void
* setOptionArgon2iTimeCost(time: int): void
Expand Down
16 changes: 8 additions & 8 deletions src/Crypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Crypt
'cost' => 12,
];

protected static string $caracters = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ' .
protected static string $characters = '!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ' .
'[\]^_`abcdefghijklmnopqrstuvwxyz{|}~';

public static function useArgon2id(): void
Expand Down Expand Up @@ -135,10 +135,10 @@ public static function needsRehash(string $hash): bool
public static function getRandomString(int $length = 64): string
{
$string = '';
$countCaracters = \mb_strlen(static::$caracters) - 1;
$countCharacters = \mb_strlen(static::$characters) - 1;

for ($i = 0; $i < $length; ++$i) {
$string .= static::$caracters[\random_int(0, $countCaracters)];
$string .= static::$characters[\random_int(0, $countCharacters)];
}

return $string;
Expand Down Expand Up @@ -222,19 +222,19 @@ public static function getOptionsBcrypt(): array
}

/**
* @param string $caracters
* @param string $characters
*/
public static function setCaractersForRandomString(string $caracters): void
public static function setCharactersForRandomString(string $characters): void
{
static::$caracters = $caracters;
static::$characters = $characters;
}

/**
* @return string
*/
public static function getCaractersForRandomString(): string
public static function getCharactersForRandomString(): string
{
return static::$caracters;
return static::$characters;
}

/** @codeCoverageIgnore */
Expand Down
8 changes: 4 additions & 4 deletions tests/CryptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ public function testSetOptionThreads(): void
}
}

public function testSetGetCaracters(): void
public function testSetGetCharacters(): void
{
Crypt::setCaractersForRandomString('aze');
$caracters = Crypt::getCaractersForRandomString();
static::assertSame('aze', $caracters);
Crypt::setCharactersForRandomString('aze');
$characters = Crypt::getCharactersForRandomString();
static::assertSame('aze', $characters);
}

public function testBigPassword(): void
Expand Down

0 comments on commit 3d78528

Please sign in to comment.