/** * @see StatementFilter::statementMatches * * @param Statement $statement * * @return bool */ public function statementMatches(Statement $statement) { $id = $statement->getPropertyId(); try { $dataType = $this->dataTypeLookup->getDataTypeIdForProperty($id); } catch (PropertyDataTypeLookupException $ex) { return false; } return in_array($dataType, $this->dataTypes); }
/** * @see StatementFilter::statementMatches * * @param Statement $statement * * @return bool */ public function statementMatches(Statement $statement) { $id = $statement->getPropertyId()->getSerialization(); return in_array($id, $this->propertyIds); }
/** * Checks if the statement's main snak is a link to the given item id * * @param Statement $statement * @param ItemId $itemId * * @throws ChangeOpException */ private function checkIsLink(Statement $statement, ItemId $itemId) { $snak = $statement->getMainSnak(); if (!$snak instanceof PropertyValueSnak) { return; } $dataValue = $snak->getDataValue(); if (!$dataValue instanceof EntityIdValue) { return; } if ($dataValue->getEntityId()->equals($itemId)) { throw new ChangeOpException("The two items cannot be merged because one of them links to the other using property {$statement->getPropertyId()}"); } }
/** * @param Statement $statement * * @return boolean */ public function statementMatches(Statement $statement) { return $this->rankMatchesFilter($statement->getRank()) && $this->propertyMatchesFilter($statement->getPropertyId()); }
/** * @dataProvider instanceProvider */ public function testGetPropertyId(Statement $statement) { $this->assertEquals($statement->getMainSnak()->getPropertyId(), $statement->getPropertyId()); }
/** * @see StatementDataUpdater::processStatement * * @param Statement $statement */ public function processStatement(Statement $statement) { $this->processSnak($statement->getMainSnak(), $statement->getPropertyId(), $statement->getRank()); }