File ParserCache.php
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Cache for outputs of the PHP parser
*
* This program is free software; you can redistribute it and/or modify
Method save
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save(
ParserOutput $parserOutput,
PageRecord $page,
$popts,
$cacheTime = null,
Function save
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function save(
ParserOutput $parserOutput,
PageRecord $page,
$popts,
$cacheTime = 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 get
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get( PageRecord $page, $popts, $useOutdated = false ) {
$page->assertWiki( PageRecord::LOCAL );
if ( !$page->exists() ) {
$this->incrementStats( $page, 'miss', 'nonexistent' );
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
string $name,
BagOStuff $cache,
string $cacheEpoch,
HookContainer $hookContainer,
JsonCodec $jsonCodec,
Method getMetadata
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getMetadata(
PageRecord $page,
int $staleConstraint = self::USE_ANYTHING
): ?ParserCacheMetadata {
$page->assertWiki( PageRecord::LOCAL );
Function get
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function get( PageRecord $page, $popts, $useOutdated = false ) {
$page->assertWiki( PageRecord::LOCAL );
if ( !$page->exists() ) {
$this->incrementStats( $page, 'miss', 'nonexistent' );
- 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 save
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ParserOutput $parserOutput,
PageRecord $page,
$popts,
$cacheTime = null,
$revId = null
Avoid too many return
statements within this method. Open
return $value;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $metadata;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return;
Avoid too many return
statements within this method. Open
return false;
Function getMetadata
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getMetadata(
PageRecord $page,
int $staleConstraint = self::USE_ANYTHING
): ?ParserCacheMetadata {
$page->assertWiki( PageRecord::LOCAL );
- 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"