repo/includes/Api/EditEntity.php
File EditEntity.php
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
declare( strict_types = 1 );
namespace Wikibase\Repo\Api;
EditEntity
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class EditEntity extends ModifyEntity {
public const PARAM_DATA = 'data';
public const PARAM_CLEAR = 'clear';
Method getExamplesMessages
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getExamplesMessages(): array {
$id = $this->sandboxEntityIds[ 'mainItem' ];
return [
// Creating new entities
Method modifyEntity
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function modifyEntity( EntityDocument $entity, ChangeOp $changeOp, array $preparedParameters ): Summary {
$data = $preparedParameters[self::PARAM_DATA];
$exists = $this->entityExists( $entity->getId() );
Method validateEntitySpecificParameters
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function validateEntitySpecificParameters(
array $preparedParameters,
EntityDocument $entity,
int $baseRevId
): void {
Method __construct
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ApiMain $mainModule,
string $moduleName,
IBufferingStatsdDataFactory $statsdDataFactory,
EntityRevisionLookup $revisionLookup,
EntityIdParser $idParser,
Function validateEntitySpecificParameters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function validateEntitySpecificParameters(
array $preparedParameters,
EntityDocument $entity,
int $baseRevId
): void {
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function modifyEntity( EntityDocument $entity, ChangeOp $changeOp, array $preparedParameters ): Summary {
$data = $preparedParameters[self::PARAM_DATA];
$exists = $this->entityExists( $entity->getId() );
- 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 factory
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
ApiMain $mainModule,
string $moduleName,
IBufferingStatsdDataFactory $statsdDataFactory,
DataTypeDefinitions $dataTypeDefinitions,
EntityChangeOpProvider $entityChangeOpProvider,