Showing 23 of 23 total issues
File QueueComponent.php
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace mirocow\queue\components;
use Amp\Loop;
Function pop
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function pop(string $queueName)
{
// Move delayed messages into waiting
if ($this->now < time()) {
$this->now = time();
- 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 run
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function run()
{
/** @var MessageModel $message */
$message = $this->getMessage();
$actionClassName = $this::$actionClassName;
- 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
QueueComponent
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class QueueComponent extends \yii\base\Component implements \mirocow\queue\interfaces\QueueInterface
{
/**
* Version.
Function argumentsValidate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function argumentsValidate($class, $method, $arguments)
{
if (isset($this->_validClassMethods[$class]) && isset($this->_validClassMethods[$class][$method])) {
$refFunc = $this->_validClassMethods[$class][$method];
$userArguments = array_keys($arguments);
- 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 run
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function run($channelName = null, $watcherId = null)
{
if (!$channelName) {
$channels = $this->getChannelNamesList();
} else {
- 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 child
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function child($message = [], $watcherId, ChannelComponent $channel)
{
if ($this->multithreading) {
$pid = pcntl_fork();
} else {
- 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 push
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function push(string $payload, string $queueName, $delay = 0, $priority = NULL)
{
if ($priority !== null) {
throw new NotSupportedException('Job priority is not supported in the driver.');
}
Method delete
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete(string $queueName, int $id = null)
{
$removed = false;
$this->touchIndex($queueName, function (&$data) use ($queueName, $id, &$removed) {
if (!empty($data['waiting'])) {
Method argumentsValidate
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function argumentsValidate($class, $method, $arguments)
{
if (isset($this->_validClassMethods[$class]) && isset($this->_validClassMethods[$class][$method])) {
$refFunc = $this->_validClassMethods[$class][$method];
$userArguments = array_keys($arguments);
Method run
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run($channelName = null, $watcherId = null)
{
if (!$channelName) {
$channels = $this->getChannelNamesList();
} else {
Method pop
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function pop(string $queueName)
{
$id = null;
$ttr = null;
$attempt = null;
Method touchIndex
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function touchIndex($queueName, $callback)
{
$fileName = "$this->path/queue__{$queueName}.data";
$isNew = !file_exists($fileName);
Method run
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run()
{
/** @var MessageModel $message */
$message = $this->getMessage();
$actionClassName = $this::$actionClassName;
Function init
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function init()
{
parent::init();
self::$_daemonize = $this->daemonize;
- 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 status
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function status(string $queueName, $id = null){
if($id) {
if (!is_numeric($id) || $id <= 0) {
throw new InvalidParamException("Unknown messages ID: $id.");
}
- 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 daemonize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected static function daemonize()
{
if (!static::$_daemonize || static::$_OS !== self::OS_TYPE_LINUX) {
return;
}
- 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 processMessage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function processMessage(MessageModel $messageModel, $watcherId = null, $pid)
{
/** @var WorkerComponent $worker */
if ($worker = $this->getWorker($messageModel->worker)) {
pcntl_signal_dispatch();
- 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 0;
Avoid too many return
statements within this method. Open
return $id;