for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the NNTP library.
*
* (c) Robin van der Vleuten <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Rvdv\Nntp\Command;
use Rvdv\Nntp\Exception\RuntimeException;
use Rvdv\Nntp\Response\Response;
/**
* AuthInfoCommand.
* @author Robin van der Vleuten <[email protected]>
class AuthInfoCommand extends Command implements CommandInterface
{
const AUTHINFO_USER = 'USER';
const AUTHINFO_PASS = 'PASS';
* @var string
private $type;
private $value;
public function __construct($type, $value)
$this->type = $type;
$this->value = $value;
parent::__construct();
}
* {@inheritdoc}
public function __invoke()
return sprintf('AUTHINFO %s %s', $this->type, $this->value);
public function onAuthenticationAccepted(Response $response)
return $response;
public function onPasswordRequired(Response $response)
public function onAuthenticationRejected(Response $response)
$response
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
throw new RuntimeException(sprintf('Authentication failed with given value for type %s', $this->type));
public function onAuthenticationOutOfSequence(Response $response)
throw new RuntimeException(sprintf('Authentication is out of sequence for type %s', $this->type));
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.