File Converter.php
has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
Converter
has 11 functions (exceeds 10 allowed). Consider refactoring. Open
class Converter implements \Magento\Framework\Config\ConverterInterface
{
const ROOT_NODE_NAME = 'analysis';
const CHAR_FILTER_TYPE_ROOT_NODE = 'char_filters';
const CHAR_FILTER_TYPE_NODE = 'char_filter';
Function getLanguageStemmers
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function getLanguageStemmers(\DOMXPath $xpath, \DomNode $rootNode, $defaultStemmer = null)
{
$stemmers = [];
$searchPath = sprintf("./%s", self::STEMMER_TYPE_NODE);
- 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 getAllDefaultLanguageStemmers
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function getAllDefaultLanguageStemmers(\DOMXPath $xpath)
{
$defaultStemmers = [];
$filterPath = "@type='stemmer' and @name='stemmer'";
- 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 getLanguageConfiguration
has 51 lines of code (exceeds 40 allowed). Consider refactoring. Open
private function getLanguageConfiguration(\DOMXPath $xpath, $language, array $defaultConfig)
{
$languageCharFilters = $this->parseFilters(
$xpath,
self::CHAR_FILTER_TYPE_ROOT_NODE,
Method parseAnalyzers
has 43 lines of code (exceeds 40 allowed). Consider refactoring. Open
private function parseAnalyzers(
\DOMXPath $xpath,
array $availableCharFilters,
array $availableFilters,
$language = self::LANGUAGE_DEFAULT,
Function parseFilters
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function parseFilters(\DOMXPath $xpath, $rootNodeName, $nodeName, $language = self::LANGUAGE_DEFAULT)
{
$filters = [];
$languagePath = sprintf("[@language='%s']", $language);
$searchPath = sprintf("/%s/%s/%s%s", self::ROOT_NODE_NAME, $rootNodeName, $nodeName, $languagePath);
- 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 parseAnalyzers
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
\DOMXPath $xpath,
array $availableCharFilters,
array $availableFilters,
$language = self::LANGUAGE_DEFAULT,
$typeRootNode = self::ANALYZER_TYPE_ROOT_NODE,
Function parseAnalyzers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function parseAnalyzers(
\DOMXPath $xpath,
array $availableCharFilters,
array $availableFilters,
$language = self::LANGUAGE_DEFAULT,
- 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"