Showing 26 of 26 total issues
Builder
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
class Builder
{
const DEFAULT_MIN = 0;
const DEFAULT_MAX = 10;
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
Field
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Field
{
/**
* Ignore this field.
*/
File Builder.php
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Bravesheep\Dogmatist;
use Bravesheep\Dogmatist\Exception\BuilderException;
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 matchingSample
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function matchingSample($builder, $callback)
{
if (is_string($builder) && !$this->getLinkManager()->hasUnlimitedSamples($builder)) {
foreach ($this->getLinkManager()->samples($builder) as $sample) {
if ($callback($sample)) {
- 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
Method makeField
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function makeField(array $mapping, Builder $builder)
{
$field = $mapping['fieldName'];
switch ($mapping['type']) {
case 'string':
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) {
Function makeField
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function makeField(array $mapping, Builder $builder)
{
$field = $mapping['fieldName'];
switch ($mapping['type']) {
case 'string':
- 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 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;
Method addFieldOfType
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function addFieldOfType($field, $type, $multiple, array $options, Builder $builder)
{
switch ($type) {
case Field::TYPE_FAKE:
$builder->fake($field, $options[0], isset($options[1]) ? $options[1] : []);
Function addFieldOfType
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function addFieldOfType($field, $type, $multiple, array $options, Builder $builder)
{
switch ($type) {
case Field::TYPE_FAKE:
$builder->fake($field, $options[0], isset($options[1]) ? $options[1] : []);
- 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 fill
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function fill(Builder $builder)
{
$manager = null;
if (Util::isUserClass($builder->getClass())) {
$manager = $this->registry->getManagerForClass($builder->getClass());
- 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 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"