File TransactionProfiler.php
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
Function recordQueryCompletion
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function recordQueryCompletion(
$query,
float $sTime,
bool $isWrite,
?int $rowCount,
- 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
TransactionProfiler
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class TransactionProfiler implements LoggerAwareInterface {
/** @var LoggerInterface */
private $logger;
/** @var StatsFactory */
private $statsFactory;
Method transactionWritingOut
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function transactionWritingOut(
$server,
$db,
string $id,
float $writeTime,
Method recordQueryCompletion
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function recordQueryCompletion(
$query,
float $sTime,
bool $isWrite,
?int $rowCount,
Function transactionWritingOut
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function transactionWritingOut(
$server,
$db,
string $id,
float $writeTime,
- 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 reportExpectationViolated
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function reportExpectationViolated(
$event,
$query,
$actual,
?string $trxId = null,
Function silenceForScope
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function silenceForScope( string $type = self::EXPECTATION_ANY ) {
if ( $type === self::EXPECTATION_REPLICAS_ONLY ) {
$events = [];
foreach ( [ 'writes', 'masterConns' ] as $event ) {
if ( $this->expect[$event][self::FLD_LIMIT] === 0 ) {
- 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 recordQueryCompletion
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$query,
float $sTime,
bool $isWrite,
?int $rowCount,
string $trxId,
Method reportExpectationViolated
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$event,
$query,
$actual,
?string $trxId = null,
?string $serverName = null
Method transactionWritingOut
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$server,
$db,
string $id,
float $writeTime,
int $affected