Showing 2,096 of 2,096 total issues
Function filterEntitySerializationUsingSiteIds
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function filterEntitySerializationUsingSiteIds(
array $serialization,
array $siteIds = null
) {
if ( $siteIds && array_key_exists( 'sitelinks', $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 addRevisionIdFromStatusToResult
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addRevisionIdFromStatusToResult( Status $status, $path, $oldRevId = null ) {
$value = $status->getValue();
if ( isset( $value['revision'] ) ) {
if ( $value['revision'] instanceof EntityRevision ) {
- 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 addTermsToResult
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function addTermsToResult( array $pagesToEntityIds, array $termGroups ): void {
$result = $this->getResult();
foreach ( $pagesToEntityIds as $currentPage => $entityId ) {
if ( !isset( $termGroups[$currentPage] ) ) {
- 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( $value ) {
$result = Result::newSuccess();
foreach ( $this->validators as $validator ) {
$subResult = $validator->validate( $value );
- 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 executeInternal
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function executeInternal(): void {
$params = $this->extractRequestParams();
$statement = $this->getStatementFromParams( $params );
$guid = $statement->getGuid();
- 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 applyChangeOp
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function applyChangeOp( ChangeOp $changeOp, EntityDocument $entity, Summary $summary = null ): ChangeOpResult {
try {
// NOTE: Always validate modification against the current revision, if it exists!
// Otherwise, we may miss e.g. a combination of language/label/description
// that was already taken.
- 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 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"