Showing 5 of 7 total issues
Function write
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function write(XMLWriter $xml, $payload, $last_key = 'entity')
{
foreach ($payload as $key => $value) {
if (is_numeric($key)) {
if (substr($last_key, -3) == 'ies') {
- Read upRead up
- Create a ticketCreate a ticket
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 generate
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generate($payload, $container = 'data')
{
$function = null;
$function_list = [
'bson_encode',
- Create a ticketCreate a ticket
Function generate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function generate($payload, $container = 'data')
{
$function = null;
$function_list = [
'bson_encode',
- Read upRead up
- Create a ticketCreate a ticket
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 getContentType
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getContentType($format = '')
{
if (empty($format) && isset($_SERVER['ACCEPT'])) {
$format = $_SERVER['ACCEPT'];
}
- Read upRead up
- Create a ticketCreate a ticket
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 generate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function generate($payload, $container = 'data')
{
if (function_exists('msgpack_pack')) {
if ($payload) {
$prevHandler = set_error_handler(function ($errno, $errstr, $errfile, $errline, $errcontext) {
- Read upRead up
- Create a ticketCreate a ticket
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"