for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the php-gelf package.
*
* (c) Benjamin Zikarsky <http://benjamin-zikarsky.de>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Gelf\Transport;
use AMQPExchange;
use AMQPQueue;
use Gelf\Encoder\JsonEncoder as DefaultEncoder;
use Gelf\MessageInterface as Message;
/**
* Class AmqpTransport
* @package Gelf\Transport
* @see http://php.net/manual/pl/book.amqp.php
class AmqpTransport extends AbstractTransport
{
* @var AMQPExchange $exchange
protected $exchange;
* @var AMQPQueue $exchange
protected $queue;
* @param AMQPExchange $exchange
* @param AMQPQueue $queue
public function __construct(AMQPExchange $exchange, AMQPQueue $queue)
$this->queue = $queue;
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
$a = "a"; $ab = "ab"; $abc = "abc";
will produce issues in the first and second line, while this second example
will produce no issues.
$this->exchange = $exchange;
$this->messageEncoder = new DefaultEncoder();
}
* @inheritdoc
public function send(Message $message)
$rawMessage = $this->getMessageEncoder()->encode($message);
$attributes = array(
'Content-type' => 'application/json'
);
// if queue is durable then mark message as 'persistent'
if (($this->queue->getFlags() & AMQP_DURABLE) > 0) {
$attributes['delivery_mode'] = 2;
$this->exchange->publish(
$rawMessage,
$this->queue->getName(),
AMQP_NOPARAM,
$attributes
return 1;
This check marks files that end in a newline character, i.e. an empy line.
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.