Showing 31 of 31 total issues
IndexService
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
class IndexService
{
private $client;
private $namespace;
private $converter;
File IndexService.php
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* This file is part of the ONGR package.
*
Function getPropertyMetadata
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function getPropertyMetadata(\ReflectionClass $class, bool $subClass = false): array
{
if ($class->isTrait() || (!$this->reader->getClassAnnotation($class, Index::class) && !$subClass)) {
return [];
}
- 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 denormalize
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
protected function denormalize(array $raw, string $namespace)
{
$metadata = $this->propertyMetadata[$namespace];
$object = new $namespace();
- 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 handleDirectoryMapping
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function handleDirectoryMapping(ContainerBuilder $container, string $dir): void
{
/** @var DocumentParser $parser */
$parser = $container->get(DocumentParser::class);
$indexesOverride = $container->getParameter(Configuration::ONGR_INDEXES_OVERRIDE);
Method execute
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$index = $this->getIndex($input->getOption(parent::INDEX_OPTION));
$indexName = $aliasName = $index->getIndexName();
File DocumentParser.php
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*
* This file is part of the ONGR package.
*
Function getClassMetadata
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function getClassMetadata(\ReflectionClass $class): array
{
$mapping = [];
$objFields = null;
$arrayFields = 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
AbstractResultsIterator
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class AbstractResultsIterator implements \Countable, \Iterator
{
private $count = 0;
private $raw;
private $scrollId;
Function normalize
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function normalize($document, $metadata = null)
{
if ($document === null) {
return 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
Method getPropertyMetadata
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPropertyMetadata(\ReflectionClass $class, bool $subClass = false): array
{
if ($class->isTrait() || (!$this->reader->getClassAnnotation($class, Index::class) && !$subClass)) {
return [];
}
Method exportIndex
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function exportIndex(
IndexService $index,
$filename,
$chunkSize,
OutputInterface $output,
Method getConfigTreeBuilder
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('ongr_elasticsearch');
Method getClassMetadata
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getClassMetadata(\ReflectionClass $class): array
{
$mapping = [];
$objFields = null;
$arrayFields = null;
Function handleDirectoryMapping
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function handleDirectoryMapping(ContainerBuilder $container, string $dir): void
{
/** @var DocumentParser $parser */
$parser = $container->get(DocumentParser::class);
$indexesOverride = $container->getParameter(Configuration::ONGR_INDEXES_OVERRIDE);
- 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 commit
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function commit($commitMode = 'refresh', array $params = []): array
{
$bulkResponse = [];
if (!empty($this->bulkQueries)) {
$this->eventDispatcher->dispatch(
Method denormalize
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function denormalize(array $raw, string $namespace)
{
$metadata = $this->propertyMetadata[$namespace];
$object = new $namespace();
Function getAnalysisConfig
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getAnalysisConfig(\ReflectionClass $class): array
{
$config = [];
$mapping = $this->getClassMetadata($class);
- 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 configure
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure()
{
parent::configure();
$this
Method getAnalysisNode
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getAnalysisNode(): NodeDefinition
{
$builder = new TreeBuilder('analysis');
if (method_exists($builder, 'getRootNode')) {