Showing 1,432 of 2,096 total issues
Function buildTermSearchMatchDisplayEntry
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function buildTermSearchMatchDisplayEntry( TermSearchResult $match, array $entry ): array {
$entry['display'] = [];
ApiResult::setArrayType( $entry['display'], 'assoc' );
$displayLabel = $match->getDisplayLabel();
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function execute(): void {
$lookup = $this->revisionLookup;
$params = $this->extractRequestParams();
$this->validateParameters( $params );
- 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 getOptionsObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getOptionsObject( ?string $optionsParam ): FormatterOptions {
$formatterOptions = new FormatterOptions();
$formatterOptions->setOption( ValueFormatter::OPT_LANG, $this->getLanguage()->getCode() );
if ( is_string( $optionsParam ) && $optionsParam !== '' ) {
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function execute(): void {
$params = $this->extractRequestParams();
$result = $this->getResult();
$context = $params['context'];
- 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 markStubEntityDataForPrefetching
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function markStubEntityDataForPrefetching( array $entityIds ): void {
foreach ( $entityIds as $id ) {
if ( !( $id instanceof EntityId ) ) {
continue;
}
- 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 addStatements
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addStatements( EntityId $entityId, StatementList $statementList ) {
$bestList = [];
// FIXME: This is expensive, share the result with TruthyStatementRdfBuilder!
foreach ( $statementList->getPropertyIds() as $propertyId ) {
- 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 getResultHtml
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getResultHtml( TermSearchResult $searchResult ): string {
$idHtml = $this->getIdHtml( $searchResult->getEntityId() );
$displayLabel = $searchResult->getDisplayLabel();
$displayDescription = $searchResult->getDisplayDescription();
- 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 validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function validate( EntityDocument $entity ) {
if ( !( $entity instanceof DescriptionsProvider ) ) {
throw new InvalidArgumentException( '$entity must be a DescriptionsProvider' );
}
- 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 addAliases
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function addAliases( $entityNamespace, $entityLName, AliasGroupList $aliases ) {
/** @var AliasGroup $aliasGroup */
foreach ( $aliases as $aliasGroup ) {
$languageCode = $aliasGroup->getLanguageCode();
if ( $this->languages !== null && !isset( $this->languages[$languageCode] ) ) {
- 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 rdfSerialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function rdfSerialize(
EntityRevision $entityRevision,
?RedirectRevision $followedRedirect,
array $incomingRedirects,
RdfBuilder $rdfBuilder,
- 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 getTermsLanguages
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getTermsLanguages(
array $userPreferredTermsLanguages,
EntityDocument $entity,
array $entityTermsListHtml
): 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 showData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function showData( WebRequest $request, OutputPage $output, $format, EntityId $id, $revision ) {
$flavor = $request->getRawVal( 'flavor' );
/** @var EntityRevision $entityRevision */
/** @var RedirectRevision $followedRedirectRevision */
- 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 validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function validate( EntityDocument $entity ) {
if ( !( $entity instanceof LabelsProvider ) ) {
throw new InvalidArgumentException( '$entity must be a LabelsProvider' );
}
- 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 updateAliases
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function updateAliases( AliasGroupList $aliases ) {
if ( $aliases->hasGroupForLanguage( $this->languageCode ) ) {
$oldAliases = $aliases->getByLanguage( $this->languageCode )->getAliases();
} else {
$oldAliases = [];
- 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 getModifiedLanguageCodes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getModifiedLanguageCodes( $original, $modified ): array {
$original = iterator_to_array( $original );
$modified = iterator_to_array( $modified );
$modifiedLanguages = [];
- 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 getPatchedCopy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getPatchedCopy( EntityContentDiff $patch ) {
$handler = $this->getContentHandler();
$redirAfterPatch = $this->getPatchedRedirect( $patch->getRedirectDiff() );
- 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 getBaseRevision
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getBaseRevision(): ?EntityRevision {
if ( $this->baseRev === null ) {
$baseRevId = $this->getBaseRevisionId();
if ( $baseRevId === $this->getLatestRevisionId() ) {
- 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 processStatements
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function processStatements( $values, $map ) {
$shortValues = array_map( function ( $str ) {
return 'wdv:' . $str;
}, $values );
$valuesStr = implode( ' ', $shortValues );
- 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 convertObjectsToArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function convertObjectsToArray( $serialization ) {
if ( !( is_object( $serialization ) || is_array( $serialization ) ) ) {
return $serialization;
}
- 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 processSnak
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function processSnak( Snak $snak ) {
if ( $snak instanceof PropertyValueSnak ) {
$id = $snak->getPropertyId();
$value = $snak->getDataValue();
- 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"