File DataGenerator.php
has 397 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Trellis\Sham;
use Trellis\Common\Error\BadValueException;
DataGenerator
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class DataGenerator
{
protected $faker;
protected $locale;
Function createComplexValue
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function createComplexValue(AttributeInterface $attribute, array $options = array())
{
$values = array();
$value_holder = $attribute->createValueHolder();
$value_type = $value_holder->getValueType();
- 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 fake
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function fake(EntityInterface $entity, array $options = array())
{
if (!empty($options[self::OPTION_LOCALE])) {
$loc = $options[self::OPTION_LOCALE];
if (!is_string($loc) || !preg_match('#[a-z]{2,6}_[A-Z]{2,6}#', $loc)) {
- 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 createComplexValue
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function createComplexValue(AttributeInterface $attribute, array $options = array())
{
$values = array();
$value_holder = $attribute->createValueHolder();
$value_type = $value_holder->getValueType();
Method fake
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function fake(EntityInterface $entity, array $options = array())
{
if (!empty($options[self::OPTION_LOCALE])) {
$loc = $options[self::OPTION_LOCALE];
if (!is_string($loc) || !preg_match('#[a-z]{2,6}_[A-Z]{2,6}#', $loc)) {
Function addTextList
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function addTextList(
EntityInterface $entity,
AttributeInterface $attribute,
array $options = array()
) {
- 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 setValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function setValue(
EntityInterface $entity,
AttributeInterface $attribute,
$default_value,
array $options = array()
- 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"