Showing 9 of 61 total issues
Function getDataFromPath
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function getDataFromPath($path, $data, $separator = "/", $ignoreEmpty = true)
{
if (isset($path) && $path !== $separator) {
// TODO possibly add functions in the $path? Such as path/to/join(data) would do a join on that data..likely belongs to EX/(sub)Parser/TR
$str = explode($separator, $path);
- 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 jsonDecode
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function jsonDecode($json, $assoc = false, $depth = 512, $options = 0, $logJson = false, $lint = false)
{
$data = json_decode($json, $assoc, $depth, $options);
switch (json_last_error()) {
case JSON_ERROR_NONE:
Function jsonDecode
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function jsonDecode($json, $assoc = false, $depth = 512, $options = 0, $logJson = false, $lint = false)
{
$data = json_decode($json, $assoc, $depth, $options);
switch (json_last_error()) {
case JSON_ERROR_NONE:
- 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 buildUrl
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function buildUrl($url, array $query = null)
{
if (!empty($query)) {
// Cleanup the input array to prevent empty Keys
foreach ($query as $k => $v) {
- 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 buildUrl
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildUrl($url, array $query = null)
{
if (!empty($query)) {
// Cleanup the input array to prevent empty Keys
foreach ($query as $k => $v) {
Function castToBool
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function castToBool($castToBool): bool
{
if (is_string($castToBool)) {
if ($castToBool === '1') {
return true;
- 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 isEmptyObject
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function isEmptyObject(\stdClass $object)
{
$vars = get_object_vars($object);
if ($vars == []) {
return true;
- 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 jsonDecode
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function jsonDecode($json, $assoc = false, $depth = 512, $options = 0, $logJson = false, $lint = false)
Avoid too many return
statements within this method. Open
return false;