Showing 2,096 of 2,096 total issues
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"
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"
Further reading
Function getStatementIdPath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getStatementIdPath( array $serialization, string $id ): string {
foreach ( $serialization as $propertyId => $statementGroup ) {
foreach ( $statementGroup as $groupIndex => $statement ) {
if ( isset( $statement['id'] ) && $statement['id'] === $id ) {
return "/statements/$propertyId/$groupIndex";
- 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 deserialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function deserialize( array $serialization, string $basePath = '' ): Statement {
if ( count( $serialization ) && array_is_list( $serialization ) ) {
throw new InvalidFieldTypeException( $serialization, $basePath );
}
- 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 getStatementIdPath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getStatementIdPath( array $serialization, string $id ): string {
foreach ( $serialization as $propertyId => $statementGroup ) {
foreach ( $statementGroup as $groupIndex => $statement ) {
if ( isset( $statement['id'] ) && $statement['id'] === $id ) {
return "/statements/$propertyId/$groupIndex";
- 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 getMultipleTermsByLanguageFromLookup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getMultipleTermsByLanguageFromLookup( EntityId $entityId, string $termType, array $languages ) {
if ( $termType === TermTypes::TYPE_LABEL ) {
$freshTerms = $this->lookup->getLabels( $entityId, $languages );
} else {
$freshTerms = $this->lookup->getDescriptions( $entityId, $languages );
- 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 storeTerms
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function storeTerms( NumericPropertyId $propertyId, Fingerprint $terms ) {
$firstException = null;
foreach ( $this->propertyTermStoreWriters as $propertyTermStoreWriter ) {
try {
$propertyTermStoreWriter->storeTerms( $propertyId, $terms );
- 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 splitIsoTimestamp
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function splitIsoTimestamp( $isoTimestamp, $precision ) {
if ( !preg_match(
'/(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)/',
$isoTimestamp,
$matches
- 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 getLatestRevisionId
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getLatestRevisionId( EntityId $entityId, $mode = LookupConstants::LATEST_FROM_REPLICA ) {
$rows = $this->entityMetaDataAccessor->loadRevisionInformation( [ $entityId ], $mode );
$row = $rows[$entityId->getSerialization()];
if ( $row && $row->page_latest ) {
- 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 extractPreferredValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function extractPreferredValue( array $data ): ?array {
if ( !$data ) {
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
Function buildStore
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function buildStore( array $sites, $siteGroup = null, $wikiId = null ) {
if ( $siteGroup === null && is_string( $wikiId ) ) {
$siteGroup = $this->getInterwikiGroup( $sites, $wikiId );
}
- 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 deleteTerms
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function deleteTerms( NumericPropertyId $propertyId ) {
$firstException = null;
foreach ( $this->propertyTermStoreWriters as $propertyTermStoreWriter ) {
try {
$propertyTermStoreWriter->deleteTerms( $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 cleanTextInLangIds
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function cleanTextInLangIds( array $textInLangIds ): void {
if ( $textInLangIds === [] ) {
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 assertFormatterArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function assertFormatterArray( $format, array $formatters ) {
foreach ( $formatters as $type => $formatter ) {
if ( !is_string( $type ) ) {
throw new InvalidArgumentException( 'formatter array must map type IDs to formatters.' );
}
- 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 setEntityTypeData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function setEntityTypeData( array $entityNamespaceIdsAndSlots ) {
foreach ( $entityNamespaceIdsAndSlots as $entityType => $namespaceIdAndSlot ) {
if ( !is_string( $entityType ) ) {
throw new \InvalidArgumentException( 'Entity type name not a string: ' . $entityType );
}
- 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"