Permalink
Browse files

Fixed phpdoc, and the command

  • Loading branch information...
1 parent 4a1d2e7 commit 75a92296891b879d00f738c2259a2104dbe27bad @willdurand willdurand committed Apr 14, 2012
View
@@ -20,23 +20,23 @@
class CleanCommand extends ContainerAwareCommand
{
/**
- * @see Command
+ * {@inheritdoc}
*/
protected function configure()
{
$this
->setName('fos:oauth-server:clean')
->setDescription('Clean expired tokens')
->setHelp(<<<EOT
-The <info>%command.name%</info> command will remove expired oauth2 tokens
+The <info>%command.name%</info> command will remove expired OAuth2 tokens.
<info>php %command.full_name%</info>
EOT
);
}
/**
- * @see Command
+ * {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
@@ -49,9 +49,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
foreach ($services as $service => $name) {
/** @var $instance TokenManagerInterface */
$instance = $this->getContainer()->get($service);
- if ($instance instanceof TokenManagerInterface or $instance instanceof AuthCodeManagerInterface) {
+ if ($instance instanceof TokenManagerInterface || $instance instanceof AuthCodeManagerInterface) {
$result = $instance->deleteExpired();
- $output->writeln(sprintf('Removed %d items from %s storage.', $result, $name));
+ $output->writeln(sprintf('Removed <info>%d</info> items from <comment>%s</comment> storage.', $result, $name));
}
}
}
@@ -17,36 +17,53 @@
interface AuthCodeManagerInterface
{
/**
- * @return \FOS\OAuthServerBundle\Model\AuthCodeInterface
+ * Create a new auth code.
+ *
+ * @return AuthCodeInterface
*/
function createAuthCode();
/**
+ * Return the class name.
+ *
* @return string
*/
function getClass();
/**
+ * Retrieve an auth code using a set of criteria.
+ *
* @param array $criteria
+ * @param AuthCodeInterface|null
*/
function findAuthCodeBy(array $criteria);
/**
- * @param string $token
+ * Retrieve an auth code by its token.
*
- * @return \FOS\OAuthServerBundle\Model\AuthCodeInterface
+ * @param string $token
+ * @param AuthCodeInterface|null
*/
function findAuthCodeByToken($token);
/**
- * @param \FOS\OAuthServerBundle\Model\AuthCodeInterface $authCode
+ * Update a given auth code.
+ *
+ * @param AuthCodeInterface $authCode
*/
function updateAuthCode(AuthCodeInterface $authCode);
/**
- * @param \FOS\OAuthServerBundle\Model\AuthCodeInterface $authCode
+ * Delete a given auth code.
+ *
+ * @param AuthCodeInterface $authCode
*/
function deleteAuthCode(AuthCodeInterface $authCode);
+ /**
+ * Delete expired auth codes.
+ *
+ * @return int The number of auth codes deleted.
+ */
function deleteExpired();
}
@@ -15,18 +15,54 @@
interface TokenManagerInterface
{
+ /**
+ * Create a new TokenInterface.
+ *
+ * @return TokenInterface
+ */
function createToken();
+ /**
+ * Return the class name of the Token.
+ *
+ * @return string
+ */
function getClass();
+ /**
+ * Retrieve a token using a set of criteria.
+ *
+ * @param array $criteria
+ * @return TokenInterface|null
+ */
function findTokenBy(array $criteria);
+ /**
+ * Retrieve a token (object) by its token string.
+ *
+ * @param string $token A token.
+ * @return TokenInterface|null
+ */
function findTokenByToken($token);
+ /**
+ * Save or update a given token.
+ *
+ * @param TokenInterface $token The token to save or update.
+ */
function updateToken(TokenInterface $token);
+ /**
+ * Delete a given token.
+ *
+ * @param TokenInterface $token The token to delete.
+ */
function deleteToken(TokenInterface $token);
+ /**
+ * Delete expired tokens.
+ *
+ * @return int The number of tokens deleted.
+ */
function deleteExpired();
}
-
View
@@ -16,6 +16,9 @@
class AuthCodeManager extends BaseAuthCodeManager
{
+ /**
+ * @var string
+ */
protected $class;
/**
@@ -27,15 +30,15 @@ public function __construct($class)
}
/**
- * @return string
+ * {@inheritdoc}
*/
public function getClass()
{
return $this->class;
}
/**
- * @param array $criteria
+ * {@inheritdoc}
*/
public function findAuthCodeBy(array $criteria)
{
@@ -47,22 +50,25 @@ public function findAuthCodeBy(array $criteria)
}
/**
- * @param \FOS\OAuthServerBundle\Model\AuthCodeInterface $authCode
+ * {@inheritdoc}
*/
public function updateAuthCode(AuthCodeInterface $authCode)
{
$authCode->save();
}
/**
- * @param \FOS\OAuthServerBundle\Model\AuthCodeInterface $authCode
+ * {@inheritdoc}
*/
public function deleteAuthCode(AuthCodeInterface $authCode)
{
$authCode->delete();
}
- function deleteExpired()
+ /**
+ * {@inheritdoc}
+ */
+ public function deleteExpired()
{
$queryClass = $this->class . 'Query';
View
@@ -16,18 +16,30 @@
class TokenManager extends BaseTokenManager
{
+ /**
+ * @var string
+ */
protected $class;
+ /**
+ * @param string $class A class name.
+ */
public function __construct($class)
{
$this->class = $class;
}
+ /**
+ * {@inheritdoc}
+ */
public function getClass()
{
return $this->class;
}
+ /**
+ * {@inheritdoc}
+ */
public function findTokenBy(array $criteria)
{
$queryClass = $this->class . 'Query';
@@ -37,17 +49,26 @@ public function findTokenBy(array $criteria)
->findOne();
}
+ /**
+ * {@inheritdoc}
+ */
public function updateToken(TokenInterface $token)
{
$token->save();
}
+ /**
+ * {@inheritdoc}
+ */
public function deleteToken(TokenInterface $token)
{
- $token->remove();
+ $token->delete();
}
- function deleteExpired()
+ /**
+ * {@inheritdoc}
+ */
+ public function deleteExpired()
{
$queryClass = $this->class . 'Query';

0 comments on commit 75a9229

Please sign in to comment.