Showing 95 of 95 total issues
Function getProcessesToTerminate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function getProcessesToTerminate(ProcessCollection $processes, Config $config, array $statusSummary)
{
$expireTime = microtime(true) - $config->getProcessIdleTimeout();
$processesToTerminate = [];
- 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 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
Method getCommandRules
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getCommandRules()
{
$eol = "[\\t\\s]*\r\n~S";
return [
'fetch' => [
Method start
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function start($launchAsDaemon)
{
$this->startTime = microtime(true);
$plugins = $this->getPluginRegistry()->count();
$this->log(Logger::INFO, sprintf("Starting Scheduler with %d plugin%s", $plugins, $plugins !== 1 ? 's' : ''));
Method __invoke
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$config = $container->get('configuration');
$mainLogger = $container->build(LoggerInterface::class, ['service_name' => 'main']);
Method setHost
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function setHost(Request $request, $serverAddress)
{
$host = $serverAddress;
$port = null;
$fullHost = $request->getHeaderOverview('Host', false);
Method decodeChunkedRequestBody
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function decodeChunkedRequestBody(Request $request, & $message)
{
$this->buffer .= $message;
while (true) {
Method onProcessLoop
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onProcessLoop(SchedulerEvent $event)
{
$exception = null;
try {
Function getApplicationConfig
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function getApplicationConfig()
{
$appConfig = static::$applicationConfig;
if (!$appConfig) {
- 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 math
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function math($command, $key, $amount)
{
$key = sha1($key);
$this->markCommandUsage('set');
$success = false;
Method checkBodyHeaders
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function checkBodyHeaders(Request $request, $boundaryLine, $pos)
{
// initialize data block
if (!isset($this->currentFormDataInfo['tmp_name'])) {
// file not opened yet, check the boundary
Method fromStringOfHeaders
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromStringOfHeaders($buffer, $allowCustomMethods)
{
if ("\r\n\r\n" !== substr($buffer, -4)) {
throw new \InvalidArgumentException(
'An EOM was not found at the end of request buffer'
Method dispatch
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dispatch(RequestInterface $request, ResponseInterface $response = null)
{
if (!$request instanceof ConsoleRequest) {
throw new \InvalidArgumentException(sprintf(
'%s can only dispatch requests in a console environment',
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
Function setHost
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function setHost(Request $request, $serverAddress)
{
$host = $serverAddress;
$port = null;
$fullHost = $request->getHeaderOverview('Host', false);
- 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 join
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function join($callId)
{
$callIds = is_array($callId) ? $callId : [$callId];
$results = [];
Method startPlugins
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function startPlugins(ContainerInterface $container, $service, array $config)
{
foreach ($config as $index => $value) {
if (is_int($index)) {
if (is_object($value) && $value instanceof ListenerAggregateInterface) {
Method modify
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function modify($command, $key, $flags, $expTime, $bytes, $requestedCas)
{
$cas = null;
$key = sha1($key);
$exists = false;
Method dispatch
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dispatch(Request $request, Response $response)
{
/** @var Application $app */
static $app;
// Run the application!
Method doJoin
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doJoin(ConnectionInterface $socket)
{
$result = $socket->read();
if ($result === false) {
throw new \RuntimeException("Async call failed: server connection lost", 1);