Showing 11 of 11 total issues
Method fromDSN
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function fromDSN($dsn, $timeout = 0, $verifySSL = false, $connectTimeout = 0)
{
$connParams = parse_url($dsn);
if ($connParams === false) {
Method parseQuery
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseQuery()
{
$rp = '';
if (is_string($this->retentionPolicy) && !empty($this->retentionPolicy)) {
Function parseQuery
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function parseQuery()
{
$rp = '';
if (is_string($this->retentionPolicy) && !empty($this->retentionPolicy)) {
- 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 __construct
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
$host,
$port = 8086,
$username = '',
$password = '',
$ssl = false,
Function getPoints
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getPoints($metricName = '', array $tags = [])
{
$points = [];
$series = $this->getSeries();
- 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 executePrivilege
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function executePrivilege($type, $privilege, $username, $database = null)
{
if (!in_array($privilege, [self::PRIVILEGE_READ, self::PRIVILEGE_WRITE, self::PRIVILEGE_ALL], true)) {
throw new Exception($privilege . ' is not a valid privileges, allowed privileges: READ, WRITE, ALL');
- 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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$measurement,
$value = null,
array $tags = array(),
array $additionalFields = array(),
$timestamp = null
Function getSeries
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getSeries($queryIndex = 0)
{
$results = $this->parsedResults['results'];
if ($queryIndex !== null && !array_key_exists($queryIndex, $results)) {
- 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 true;
Function setFields
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setFields($fields)
{
foreach ($fields as &$field) {
if (is_int($field)) {
$field = sprintf('%di', $field);
- 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 __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($dsn, $options = [])
{
if (!extension_loaded('curl')) {
throw new Exception('Curl extension is not enabled!');
}
- 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"