Showing 75 of 579 total issues
Function validate
has a Cognitive Complexity of 156 (exceeds 5 allowed). Consider refactoring. Open
public function validate(SchemaDescriptor $a, SchemaDescriptor $b /* ignored */)
{
/** @var FieldDescriptor[] $currentFields */
/** @var FieldDescriptor[] $inheritedFields */
$currentFields = $a->getFields();
- 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 getSchemas
has 193 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSchemas()
{
return [
[
'schema' => new SchemaDescriptor(
Function generateManifest
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
public function generateManifest(array $schemas)
{
$response = new GeneratorResponse();
$manifests = ['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 validate
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate(SchemaDescriptor $a, SchemaDescriptor $b /* ignored */)
{
/** @var FieldDescriptor[] $currentFields */
/** @var FieldDescriptor[] $inheritedFields */
$currentFields = $a->getFields();
Function __construct
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function __construct()
{
$enums = [];
$schemas = [];
- 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 parse
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
private function parse(array $data)
{
$schemaId = SchemaId::fromString($data['id']);
$parameters = [
- 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 convertDomElementToArray
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public static function convertDomElementToArray(\DomElement $element, $checkPrefix = true)
{
$prefix = (string)$element->prefix;
$empty = true;
$config = [];
- 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 getSchemas
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSchemas()
{
return [
[
'schema' => new SchemaDescriptor(
FieldDescriptor
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
final class FieldDescriptor
{
/**
* Regular expression pattern for matching a valid field name. The pattern allows
* for camelCase fields name but snake_case is recommend.
Method generateManifest
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateManifest(array $schemas)
{
$response = new GeneratorResponse();
$manifests = ['all' => []];
Function validate
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function validate(SchemaDescriptor $a, SchemaDescriptor $b)
{
$fa = array_merge($a->getInheritedFields(), $a->getFields());
$fb = array_merge($b->getInheritedFields(), $b->getFields());
- 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 23 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($name, array $parameters)
{
if (!$name || strlen($name) > 127 || preg_match(self::VALID_NAME_PATTERN, $name) === false) {
throw new \InvalidArgumentException(
sprintf(
- 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
FieldDescriptorTest
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class FieldDescriptorTest extends \PHPUnit_Framework_TestCase
{
/** FieldDescriptor */
protected $field;
Generator
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class Generator
{
const TEMPLATE_DIR = __DIR__ . '/Twig/';
const LANGUAGE = 'unknown';
const EXTENSION = '.unk';
Method __construct
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct()
{
$enums = [];
$schemas = [];
Function run
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function run($language, CompileOptions $options)
{
$namespaces = $options->getNamespaces();
if (!$namespaces || count($namespaces) === 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
Function loadFile
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function loadFile($file, $schemaOrCallable = null)
{
$content = @file_get_contents($file);
if ('' === trim($content)) {
throw new \InvalidArgumentException(sprintf('File %s does not contain valid XML, it is empty.', $file));
- 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 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($name, array $parameters)
{
if (!$name || strlen($name) > 127 || preg_match(self::VALID_NAME_PATTERN, $name) === false) {
throw new \InvalidArgumentException(
sprintf(
Function validate
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function validate(SchemaDescriptor $a, SchemaDescriptor $b)
{
$fa = array_merge($a->getInheritedFields(), $a->getFields());
$fb = array_merge($b->getInheritedFields(), $b->getFields());
- 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
File FieldDescriptor.php
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Gdbots\Pbjc;
use Gdbots\Common\Util\NumberUtils;