Showing 95 of 95 total issues
Function stopServices
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function stopServices($services, $mustBeRunning)
{
$servicesAmount = 0;
foreach ($services as $service) {
try {
- 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 parseCommand
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function parseCommand()
{
$command = explode(" ", ltrim($this->buffer), 2);
$command = $command[0];
$commandRules = $this->getCommandRules();
- 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 parseCommand
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseCommand()
{
$command = explode(" ", ltrim($this->buffer), 2);
$command = $command[0];
$commandRules = $this->getCommandRules();
Method doWrite
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doWrite($writeMethod)
{
if (!$this->isWritable()) {
$this->data = '';
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 dispatch
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dispatch(Request $request, Response $response)
{
$path = $request->getUri()->getPath();
$code = Response::STATUS_CODE_200;
Method isSupported
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function isSupported()
{
$className = basename(str_replace('\\', '/', static::class));
if (!$this->isPcntlExtensionLoaded()) {
Method handleMessages
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handleMessages()
{
$this->schedulerStatus->updateStatus();
/** @var Message[] $messages */
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) {
Method startServices
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function startServices($serviceNames)
{
$plugins = $this->getPluginRegistry()->count();
$this->logger->info(sprintf("Starting Server Service Manager with %d plugin%s", $plugins, $plugins !== 1 ? 's' : ''));
Function detectNumberOfCores
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected static function detectNumberOfCores()
{
if (is_file('/proc/cpuInfo') && is_readable('/proc/cpuInfo')) {
$cpuInfo = file_get_contents('/proc/cpuInfo');
if (preg_match_all('/^processor/m', $cpuInfo, $matches)) {
- 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 getQueueInfo
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function getQueueInfo()
{
if (!$this->queueInfo) {
$queueId = null;
$queue = $this->ipc[0] ? $this->ipc[0] : ($this->ipc[1] ? $this->ipc[1] : null);
- 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 doWrite
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function doWrite($writeMethod)
{
if (!$this->isWritable()) {
$this->data = '';
- 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 __invoke
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$channelName = $options['service_name'];
$logger = $options['logger_adapter'];
- 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 __invoke
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$config = $container->get('configuration');
$loggerConfig = isset($config['zeus_process_manager']['logger']) ? $config['zeus_process_manager']['logger'] : [];
Method getStatus
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getStatus()
{
$payload = [
'isEvent' => false,
'type' => Message::IS_STATUS_REQUEST,
Method store
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function store($command, $key, $flags, $expTime)
{
$key = sha1($key);
$this->markCommandUsage('set');
$result = false;
Method send
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function send($message)
{
$channelNumber = $this->channelNumber;
$channelNumber == 0 ?
Method doStartService
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doStartService($serviceName)
{
$service = $this->getService($serviceName);
$event = $this->getEvent();
Method decodeRegularRequestBody
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function decodeRegularRequestBody(Request $request, & $message)
{
$expectedBodyLength = $request->getHeaderOverview('Content-Length', false);
if (false === $expectedBodyLength) {