File Message.php
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Zeus\ServerService\Http\Message;
use Zeus\ServerService\Http\Message\Helper\ChunkedEncoding;
Message
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class Message implements MessageComponentInterface, HeartBeatMessageInterface
{
use ChunkedEncoding;
use RegularEncoding;
use FileUpload;
Function sendBody
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function sendBody(ConnectionInterface $connection, $buffer)
{
if ($this->isBodyAllowedInResponse($this->request)) {
$isChunkedResponse = $this->response->getMetadata('isChunkedResponse');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function onMessage
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function onMessage(ConnectionInterface $connection, $message)
{
$this->requestPhase = static::REQUEST_PHASE_READING;
if (!$this->headersReceived) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method enableCompressionIfSupported
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function enableCompressionIfSupported(& $buffer)
{
$this->compressionHandler = null;
if (!function_exists('deflate_init') || !$this->isBodyAllowedInResponse($this->request)) {
Method onMessage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onMessage(ConnectionInterface $connection, $message)
{
$this->requestPhase = static::REQUEST_PHASE_READING;
if (!$this->headersReceived) {
Function enableCompressionIfSupported
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function enableCompressionIfSupported(& $buffer)
{
$this->compressionHandler = null;
if (!function_exists('deflate_init') || !$this->isBodyAllowedInResponse($this->request)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function sendResponse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function sendResponse($buffer)
{
$connection = $this->connection;
if (!$this->headersSent) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Function sendHeaders
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function sendHeaders(& $buffer)
{
$connection = $this->connection;
$this->request->setMetadata('remoteAddress', $connection->getRemoteAddress());
$response = $this->response;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"