Showing 1,432 of 2,096 total issues
Method getItem
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getItem(): ?Item {
$params = $this->getParams();
$itemId = new ItemId( $params['entityId'] );
try {
$entity = $this->entityLookup->getEntity( $itemId );
Method onBeforePageDisplay
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
$entityNamespaceLookup = WikibaseRepo::getEntityNamespaceLookup();
$namespace = $out->getTitle()->getNamespace();
$isEntityTitle = $entityNamespaceLookup->isNamespaceWithEntities( $namespace );
$settings = WikibaseRepo::getSettings();
Method validateEntity
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function validateEntity( EntityDocument $entity ) {
$entityId = $entity->getId()->getSerialization();
$entityType = $entity->getType();
if ( $entity instanceof LabelsProvider ) {
Method getFlavor
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getFlavor( ?string $flavorName ): int {
switch ( $flavorName ) {
case 'simple':
return RdfProducer::PRODUCE_TRUTHY_STATEMENTS
| RdfProducer::PRODUCE_SITELINKS
Method validate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function validate( EntityDocument $entity ) {
if ( !( $entity instanceof DescriptionsProvider ) ) {
throw new InvalidArgumentException( '$entity must be a DescriptionsProvider' );
}
Method factory
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function factory(
Language $contentLanguage,
HttpRequestFactory $httpRequestFactory,
IBufferingStatsdDataFactory $statsdDataFactory,
UserOptionsLookup $userOptionsLookup,
Method formatArg
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function formatArg( $arg ) {
try {
if ( $arg instanceof Snak ) {
return $this->snakFormatter->formatSnak( $arg );
} elseif ( $arg instanceof EntityId ) {
Method validateBadgeSerialization
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function validateBadgeSerialization( array $serialization ) {
foreach ( $serialization as $badgeSerialization ) {
if ( !is_string( $badgeSerialization ) ) {
throw new ChangeOpDeserializationException(
'Badges: a string was expected, but not found',
Method getValueBuilder
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function getValueBuilder( $dataTypeId, $dataValueType ) {
if ( $dataTypeId !== null ) {
if ( isset( $this->valueBuilders["PT:$dataTypeId"] ) ) {
return $this->valueBuilders["PT:$dataTypeId"];
}
Method validate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function validate( EntityDocument $entity ) {
if ( !( $entity instanceof LabelsProvider ) ) {
throw new InvalidArgumentException( '$entity must be a LabelsProvider' );
}
Method addEntityPageProps
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function addEntityPageProps( EntityDocument $entity ): void {
if ( !$this->shouldProduce( RdfProducer::PRODUCE_PAGE_PROPS ) ) {
return;
}
$pagePropertyDefs = $this->getPagePropertyDefs();
Method __construct
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function __construct() {
parent::__construct();
$this->addDescription( 'Rebuilds entity quantity unit values' );
Method execute
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute( PatchPropertyAliasesRequest $request ): PatchPropertyAliasesResponse {
$deserializedRequest = $this->validator->validateAndDeserialize( $request );
$editMetadata = $deserializedRequest->getEditMetadata();
$this->assertPropertyExists->execute( $deserializedRequest->getPropertyId() );
Method assertValidAliases
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function assertValidAliases( array $serialization ): void {
$aliasesSerialization = $serialization[ 'aliases' ] ?? [];
$validationError = $this->aliasesValidator->validate( $aliasesSerialization, '/aliases' );
if ( $validationError ) {
$errorCode = $validationError->getCode();
Method execute
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function execute( SetItemDescriptionRequest $request ): SetItemDescriptionResponse {
$deserializedRequest = $this->validator->validateAndDeserialize( $request );
$itemId = $deserializedRequest->getItemId();
$description = $deserializedRequest->getItemDescription();
$editMetadata = $deserializedRequest->getEditMetadata();
Method getHeadingHtml
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function getHeadingHtml(
$languageCode,
EntityId $entityId = null,
AliasGroupList $aliasGroups = null
) {
Method deserialize
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function deserialize( array $serialization, string $basePath = '' ): Statement {
if ( count( $serialization ) && array_is_list( $serialization ) ) {
throw new InvalidFieldTypeException( $serialization, $basePath );
}
Method assertValidLabelsAndDescriptions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function assertValidLabelsAndDescriptions( array $serialization, Item $originalItem ): void {
$labels = $serialization['labels'] ?? [];
$descriptions = $serialization['descriptions'] ?? [];
$validationError = $this->labelsSyntaxValidator->validate( $labels, '/labels' ) ??
$this->descriptionsSyntaxValidator->validate( $descriptions, '/descriptions' ) ??
Method getEntityRevisionFromCache
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getEntityRevisionFromCache(
EntityId $entityId,
$revisionId = 0,
$mode = LookupConstants::LATEST_FROM_REPLICA
) {
Method selectFieldValuesForPrimaryKey
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function selectFieldValuesForPrimaryKey(
string $table,
string $selectedVar,
string $primaryKeyVar,
array $primaryKeyValues,