Showing 177 of 223 total issues
Method getUsedEmbedDefinitions
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getUsedEmbedDefinitions(EntityTypeDefinition $type_definition)
{
$embed_types_definitions_list = new EntityTypeDefinitionList();
$embed_type_attributes = $type_definition->getAttributes()->filterByType('embedded-entity-list');
Method execute
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute($value, EntityInterface $entity = null)
{
$null_value = $this->getOption(AttributeInterface::OPTION_NULL_VALUE, null);
if ($value === $null_value || $value === '') {
// accept NULL or empty string as valid NULL value when NULL value is NULL :D
Method execute
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute($value, EntityInterface $entity = null)
{
if (is_null($value)) {
$value = '';
}
Method castArray
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function castArray($array)
{
$value_type = $this->getOption(self::OPTION_VALUE_TYPE, self::VALUE_TYPE_SCALAR);
$casted = [];
Method parseOffsetExpression
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function parseOffsetExpression($offset_expression)
{
$compare_attribute = null;
$compare_value = null;
Method execute
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute($value, EntityInterface $entity = null)
{
if (!is_string($value)) {
$this->throwError('non_string_value', [], IncidentInterface::CRITICAL);
return false;
Function execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function execute($value, EntityInterface $entity = null)
{
try {
if (is_array($value)) {
if (!empty($value) && !$this->isAssoc($value)) {
- 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 execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function execute($value, EntityInterface $entity = null)
{
try {
if (is_array($value)) {
if (!empty($value) && !$this->isAssoc($value)) {
- 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 getConfusableChecker
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getConfusableChecker()
{
$spoofchecker = new Spoofchecker();
// Allowing only certain locales enables rejection of e.g. korean script when a text should be en_US only
Method getUrlFromArray
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getUrlFromArray(array $url_parts)
{
// generate the resulting URL
$url = $url_parts['scheme'] . $this->getOption(self::OPTION_SCHEME_SEPARATOR, '://');
Method getAttributeByPath
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getAttributeByPath(EntityTypeInterface $type, $attribute_path)
{
$path_parts = explode(self::PATH_DELIMITER, $attribute_path);
if ($path_parts % 2 === 0) {
Method getSuspiciousChecker
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getSuspiciousChecker()
{
$spoofchecker = new Spoofchecker();
// Allowing only certain locales enables rejection of e.g. korean script when a text should be en_US only
Method getValidator
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getValidator()
{
if (!$this->validator) {
$default_validator_class = Validator::CLASS;
$validator_implementor = $this->getOption(self::OPTION_VALIDATOR, $default_validator_class);
Method getMetadataOptions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getMetadataOptions()
{
$options = $this->getOptions();
$value_type = self::METADATA_VALUE_TYPE_SCALAR;
Method createEntityList
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function createEntityList(array $entities_data)
{
$type_map = [];
foreach ($this->getOption(self::OPTION_REFERENCE_MODULES, []) as $type) {
$type_map[$type->getEntityType()] = $type;
Method getMetadataOptions
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getMetadataOptions()
{
$options = $this->getOptions();
$value_type = self::METADATA_VALUE_TYPE_SCALAR;
Function execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function execute($value, EntityInterface $entity = null)
{
try {
if (is_array($value)) {
if (!empty($value) && !$this->isAssoc($value)) {
- 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 valueEquals
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function valueEquals($other_value)
{
if (!is_array($other_value)) {
return false;
}
- 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 valueEquals
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function valueEquals($other_value)
{
if (!is_array($other_value)) {
return false;
}
- 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 createEntityList
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function createEntityList(array $entities_data)
{
$type_map = [];
foreach ($this->getOption(self::OPTION_REFERENCE_MODULES, []) as $type) {
$type_map[$type->getEntityType()] = $type;
- 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"