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;
/**
* PostCommand.
* @author thebandit
class PostArticleCommand extends Command implements CommandInterface
{
* @var string
private $groups;
private $subject;
private $body;
private $from;
private $headers;
* Constructor.
public function __construct($groups, $subject, $body, $from, $headers)
$this->groups = $groups;
$this->subject = $subject;
$this->body = $body;
$this->from = $from;
$this->headers = $headers;
parent::__construct();
}
* {@inheritdoc}
public function __invoke()
$article = 'From: '.$this->from."\r\n";
$article .= 'Newsgroups: '.$this->groups."\r\n";
$article .= 'Subject: '.$this->subject."\r\n";
$article .= "X-poster: php-nntp\r\n";
if ($this->headers !== null) {
$article .= $this->headers."\r\n";
$article .= "\r\n";
$article .= $this->body;
return $article;
public function onArticleReceived(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.
public function onPostingFailed(Response $response)
throw new RuntimeException(sprintf('Posting failed: %s', $response->getMessage()), $response->getStatusCode());
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.