Function sample
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function sample(Builder $builder, UniqueArrayObject $parent = null)
{
$data = new UniqueArrayObject($parent);
$faker = $this->dogmatist->getFaker();
foreach ($builder->getFields() as $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
File Sampler.php
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Bravesheep\Dogmatist;
use Bravesheep\Dogmatist\Exception\SampleException;
Function setObjectProperty
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function setObjectProperty($obj, $key, $value, Builder $builder)
{
if ($value instanceof ReplacableArray) {
foreach ($value->data as &$subval) {
foreach ($subval->fields as $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 sampleField
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function sampleField(Field $field, UniqueArrayObject $data)
{
$faker = $this->dogmatist->getFaker();
$type = $field->getType();
$value = null;
- 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 replaceLinksInObject
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function replaceLinksInObject($obj, Builder $builder)
{
foreach (get_object_vars($obj) as $key => $value) {
if ($value instanceof ReplacableArray) {
foreach ($value->data as &$subval) {
- 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 replaceLinksInArray
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function replaceLinksInArray(array $data, Builder $builder)
{
foreach ($data as $key => &$value) {
if ($value instanceof ReplacableArray) {
foreach ($value->data as &$subval) {
- 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 alignArgs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function alignArgs(\ReflectionMethod $constructor, array $data, ConstructorBuilder $builder)
{
if ($builder->isPositional()) {
$aligned = $data;
} else {
- 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 setObjectProperty
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function setObjectProperty($obj, $key, $value, Builder $builder)
{
if ($value instanceof ReplacableArray) {
foreach ($value->data as &$subval) {
foreach ($subval->fields as $field) {
Method sample
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sample(Builder $builder, UniqueArrayObject $parent = null)
{
$data = new UniqueArrayObject($parent);
$faker = $this->dogmatist->getFaker();
foreach ($builder->getFields() as $field) {
Method sampleField
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function sampleField(Field $field, UniqueArrayObject $data)
{
$faker = $this->dogmatist->getFaker();
$type = $field->getType();
$value = null;
Function constructObject
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function constructObject(\ReflectionClass $refl, Builder $builder)
{
$constructor = $refl->getConstructor();
$obj = null;
if (null === $constructor || $constructor->getNumberOfParameters() === 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"