Showing 2,096 of 2,096 total issues
Function addEntityRevision
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addEntityRevision(
$sourceEntityIdSerialization,
EntityRevision $entityRevision,
$props = 'all',
array $filterSiteIds = 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 getForm
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function getForm( EntityDocument $entity = null ) {
if ( $this->page === null ) {
$this->page = $this->site === null ? '' : $this->getSiteLink( $entity, $this->site );
}
if ( !$this->badges ) {
- 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 saveRedirect
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function saveRedirect(
EntityRedirect $redirect,
FormatableSummary $summary,
IContextSource $context,
bool $bot,
- 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 createEntity
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function createEntity( $entityType, EntityId $customId = null, $assignFreshId = self::ASSIGN_FRESH_ID ): EntityDocument {
if ( $customId ) {
$entityType = $customId->getEntityType();
} elseif ( !$entityType ) {
$this->errorReporter->dieError(
- 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 modifyEntity
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function modifyEntity( EntityDocument $entity, ChangeOp $changeOp, array $preparedParameters ): Summary {
if ( !( $entity instanceof Item ) ) {
$this->errorReporter->dieError( "The given entity is not an item", "not-item" );
}
- 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 resolveMentionedEntities
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function resolveMentionedEntities(): void {
$hasRedirect = false;
$this->markStubEntityDataForPrefetching( $this->entitiesResolved );
- 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 onShowSearchHit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function onShowSearchHit( $searchPage, $result,
$terms, &$link, &$redirect, &$section, &$extract, &$score, &$size, &$date, &$related,
&$html
): void {
if ( $result instanceof ExtendedResult ) {
- 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 addEntityPageProps
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addEntityPageProps( EntityDocument $entity ): void {
if ( !$this->shouldProduce( RdfProducer::PRODUCE_PAGE_PROPS ) ) {
return;
}
$pagePropertyDefs = $this->getPagePropertyDefs();
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function validate( EntityDocument $entity ) {
$languageValidator = $this->termValidatorFactory->getAliasLanguageValidator();
$termValidator = $this->termValidatorFactory->getAliasValidator();
// check that the language is valid
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$newJsonName = $this->getOption( 'config' );
$newJson = json_decode( file_get_contents( $newJsonName ), true );
if ( !$newJson ) {
$this->fatalError( "Cannot load new config" );
- 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 rebuild
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function rebuild() {
$ticket = $this->db->getEmptyTransactionTicket( __METHOD__ );
$counter = 0;
while ( true ) {
- 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 getIdentifiersCount
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getIdentifiersCount( StatementList $statementList ): int {
$identifiers = 0;
foreach ( $statementList as $statement ) {
$propertyId = $statement->getPropertyId();
$propertyIdSerialization = $propertyId->getSerialization();
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function validate(
?string $itemId,
string $siteId,
array $sitelink,
string $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 getTitlesForIds
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getTitlesForIds( array $ids ): array {
Assert::parameterElementType( EntityId::class, $ids, '$ids' );
$titles = [];
$idsByType = [];
// get whatever federated ids or cached ids we can, and batch the rest of the ids by 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"
Further reading
Function findPrimaryCoordinateKey
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function findPrimaryCoordinateKey() {
foreach ( $this->preferredPropertiesIds as $id ) {
$key = $this->makeCoordinateKey( $id, Statement::RANK_PREFERRED );
$preferredCount = $this->getCoordinatesGroupCount( $key );
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function deserialize( array $serialization, string $basePath ): array {
if ( !count( $serialization ) || !array_is_list( $serialization ) ) {
$parts = explode( '/', $basePath );
throw new InvalidFieldException( $parts[array_key_last( $parts )], $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 getHtml
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getHtml( TermFallback $term ) {
$requestedLanguage = $term->getLanguageCode();
$actualLanguage = $term->getActualLanguageCode();
$sourceLanguage = $term->getSourceLanguageCode();
- 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 __construct
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( array $fields = [] ) {
Assert::parameter(
!array_diff( array_keys( $fields ), self::FIELD_NAMES ),
'$fields',
'must only contain the following keys: termType, termLanguage, termText'
- 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 toStandardUnits
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function toStandardUnits( UnboundedQuantityValue $value ) {
$fromUnit = $value->getUnit();
if ( $fromUnit === '1' ) {
// Won't convert unitless values
- 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 getLinks
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getLinks(
?array $numericIds = null,
?array $siteIds = null,
?array $pageNames = null
): 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"