mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
- fix phpstorm warnings
This commit is contained in:
@@ -18,7 +18,9 @@ use Alchemy\Phrasea\Model\Entities\User;
|
|||||||
use Alchemy\Phrasea\Model\Repositories\TokenRepository;
|
use Alchemy\Phrasea\Model\Repositories\TokenRepository;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Doctrine\Common\Persistence\ObjectManager;
|
use Doctrine\Common\Persistence\ObjectManager;
|
||||||
|
use InvalidArgumentException;
|
||||||
use RandomLib\Generator;
|
use RandomLib\Generator;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
class TokenManipulator implements ManipulatorInterface
|
class TokenManipulator implements ManipulatorInterface
|
||||||
{
|
{
|
||||||
@@ -69,7 +71,7 @@ class TokenManipulator implements ManipulatorInterface
|
|||||||
$n = 0;
|
$n = 0;
|
||||||
do {
|
do {
|
||||||
if ($n++ > 1024) {
|
if ($n++ > 1024) {
|
||||||
throw new \RuntimeException('Unable to create a token.');
|
throw new RuntimeException('Unable to create a token.');
|
||||||
}
|
}
|
||||||
$value = $this->random->generateString(32, self::LETTERS_AND_NUMBERS);
|
$value = $this->random->generateString(32, self::LETTERS_AND_NUMBERS);
|
||||||
$found = null !== $this->om->getRepository('Phraseanet:Token')->find($value);
|
$found = null !== $this->om->getRepository('Phraseanet:Token')->find($value);
|
||||||
@@ -99,7 +101,7 @@ class TokenManipulator implements ManipulatorInterface
|
|||||||
public function createBasketValidationToken(Basket $basket, User $user, DateTime $expiration)
|
public function createBasketValidationToken(Basket $basket, User $user, DateTime $expiration)
|
||||||
{
|
{
|
||||||
if (null === $basket->getValidation()) {
|
if (null === $basket->getValidation()) {
|
||||||
throw new \InvalidArgumentException('A validation token requires a validation basket.');
|
throw new InvalidArgumentException('A validation token requires a validation basket.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->create($user, self::TYPE_VALIDATE, $expiration, $basket->getId());
|
return $this->create($user, self::TYPE_VALIDATE, $expiration, $basket->getId());
|
||||||
@@ -133,7 +135,6 @@ class TokenManipulator implements ManipulatorInterface
|
|||||||
* @param User[] $users
|
* @param User[] $users
|
||||||
* @param FeedEntry $entry
|
* @param FeedEntry $entry
|
||||||
* @return Token[]
|
* @return Token[]
|
||||||
* @throws \Doctrine\DBAL\DBALException
|
|
||||||
*/
|
*/
|
||||||
public function createFeedEntryTokens($users, FeedEntry $entry)
|
public function createFeedEntryTokens($users, FeedEntry $entry)
|
||||||
{
|
{
|
||||||
@@ -203,6 +204,7 @@ class TokenManipulator implements ManipulatorInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param User $user
|
* @param User $user
|
||||||
|
* @param string $email
|
||||||
*
|
*
|
||||||
* @return Token
|
* @return Token
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user