Denny Vrandecic has submitted this change and it was merged.
Change subject: Removed PropertyValue class
......................................................................
Removed PropertyValue class
Change-Id: Ib1d6b79efe25e5d144ea5f949b810c002f53b600
---
M DataValues/DataValues.classes.php
M DataValues/DataValues.mw.php
M DataValues/DataValues.php
D DataValues/includes/values/PropertyValue.php
D DataValues/tests/phpunit/includes/values/PropertyValueTest.php
5 files changed, 0 insertions(+), 231 deletions(-)
Approvals:
Denny Vrandecic: Looks good to me, approved
jenkins-bot: Verified
diff --git a/DataValues/DataValues.classes.php
b/DataValues/DataValues.classes.php
index 3be6c88..d7cce09 100644
--- a/DataValues/DataValues.classes.php
+++ b/DataValues/DataValues.classes.php
@@ -33,7 +33,6 @@
'DataValues\MonolingualTextValue' =>
'includes/values/MonolingualTextValue.php',
'DataValues\MultilingualTextValue' =>
'includes/values/MultilingualTextValue.php',
'DataValues\NumberValue' => 'includes/values/NumberValue.php',
- 'DataValues\PropertyValue' => 'includes/values/PropertyValue.php',
'DataValues\QuantityValue' => 'includes/values/QuantityValue.php',
'DataValues\StringValue' => 'includes/values/StringValue.php',
'DataValues\TimeValue' => 'includes/values/TimeValue.php',
diff --git a/DataValues/DataValues.mw.php b/DataValues/DataValues.mw.php
index 1513980..42ce0cf 100644
--- a/DataValues/DataValues.mw.php
+++ b/DataValues/DataValues.mw.php
@@ -65,7 +65,6 @@
'includes/values/MonolingualTextValue',
'includes/values/MultilingualTextValue',
'includes/values/NumberValue',
- 'includes/values/PropertyValue',
'includes/values/QuantityValue',
'includes/values/StringValue',
'includes/values/TimeValue',
diff --git a/DataValues/DataValues.php b/DataValues/DataValues.php
index 7d95609..66faf88 100644
--- a/DataValues/DataValues.php
+++ b/DataValues/DataValues.php
@@ -74,7 +74,6 @@
$wgDataValues['monolingualtext'] = 'DataValues\MonolingualTextValue';
$wgDataValues['multilingualtext'] = 'DataValues\MultilingualTextValue';
$wgDataValues['number'] = 'DataValues\NumberValue';
-$wgDataValues['property'] = 'DataValues\PropertyValue';
$wgDataValues['quantity'] = 'DataValues\QuantityValue';
$wgDataValues['string'] = 'DataValues\StringValue';
$wgDataValues['time'] = 'DataValues\TimeValue';
diff --git a/DataValues/includes/values/PropertyValue.php
b/DataValues/includes/values/PropertyValue.php
deleted file mode 100644
index 0831dd7..0000000
--- a/DataValues/includes/values/PropertyValue.php
+++ /dev/null
@@ -1,155 +0,0 @@
-<?php
-
-namespace DataValues;
-
-use InvalidArgumentException;
-
-/**
- * Class representing the identity of a property.
- *
- * Loosely based on SMWDIProperty.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @since 0.1
- *
- * @file
- * @ingroup DataValue
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class PropertyValue extends DataValueObject {
-
- /**
- * @since 0.1
- *
- * @var string
- */
- protected $id;
-
- /**
- * @since 0.1
- *
- * @param string $propertyId
- *
- * @throws InvalidArgumentException
- */
- public function __construct( $propertyId ) {
- if ( !is_string( $propertyId ) ) {
- throw new InvalidArgumentException( 'Can only construct
PropertyValue with a string id' );
- }
-
- $this->id = $propertyId;
- }
-
- /**
- * @see Serializable::serialize
- *
- * @since 0.1
- *
- * @return int|float
- */
- public function serialize() {
- return json_encode( array( $this->id ) );
- }
-
- /**
- * @see Serializable::unserialize
- *
- * @since 0.1
- *
- * @param string $value
- *
- * @return NumberValue
- * @throws InvalidArgumentException
- */
- public function unserialize( $value ) {
- $data = json_decode( $value );
-
- if ( !is_array( $data ) || !array_key_exists( 0, $data ) ) {
- throw new InvalidArgumentException( 'Invalid
serialization provided' );
- }
-
- $this->__construct( $data[0] );
- }
-
- /**
- * @see DataValue::getType
- *
- * @since 0.1
- *
- * @return string
- */
- public function getType() {
- return 'property';
- }
-
- /**
- * @see DataValue::getSortKey
- *
- * @since 0.1
- *
- * @return string|float|int
- */
- public function getSortKey() {
- return $this->id;
- }
-
- /**
- * @see DataValue::getArrayValue
- *
- * @since 0.1
- *
- * @return mixed
- */
- public function getArrayValue() {
- return array(
- 'propertyId' => $this->id,
- );
- }
-
- /**
- * @see DataValue::getValue
- *
- * @since 0.1
- *
- * @return mixed
- */
- public function getValue() {
- return $this->id;
- }
-
- /**
- * Constructs a new instance of the DataValue from the provided data.
- * This can round-trip with @see getArrayValue
- *
- * @since 0.1
- *
- * @param mixed $data
- *
- * @return PropertyValue
- * @throws InvalidArgumentException
- */
- public static function newFromArray( $data ) {
- if ( !is_array( $data ) || !array_key_exists( 'propertyId',
$data ) ) {
- throw new InvalidArgumentException( 'Cannot construct
instance from invalid array format' );
- }
-
- return new static( $data['propertyId'] );
- }
-
-}
diff --git a/DataValues/tests/phpunit/includes/values/PropertyValueTest.php
b/DataValues/tests/phpunit/includes/values/PropertyValueTest.php
deleted file mode 100644
index 6912bd2..0000000
--- a/DataValues/tests/phpunit/includes/values/PropertyValueTest.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-
-namespace DataValues\Test;
-
-/**
- * Tests for the DataValues\PropertyValue class.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @since 0.1
- *
- * @ingroup DataValue
- *
- * @group DataValue
- * @group DataValueExtensions
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class PropertyValueTest extends DataValueTest {
-
- /**
- * @see DataValueTest::getClass
- *
- * @since 0.1
- *
- * @return string
- */
- public function getClass() {
- return 'DataValues\PropertyValue';
- }
-
- /**
- * @see DataValueTest::constructorProvider
- *
- * @since 0.1
- *
- * @return array
- */
- public function constructorProvider() {
- $argLists = array();
-
- $argLists[] = array( false );
- $argLists[] = array( true, 'foo' );
- $argLists[] = array( true, 'bar' );
- $argLists[] = array( true, 'foo bar' );
- $argLists[] = array( true, 'p42' );
- $argLists[] = array( true, '_geo' );
- $argLists[] = array( false, 4.2 );
- $argLists[] = array( false, 42 );
- $argLists[] = array( false, array( 'foo' ) );
- $argLists[] = array( false, true );
- $argLists[] = array( false, false );
- $argLists[] = array( false, null );
-
- return $argLists;
- }
-
-}
--
To view, visit https://gerrit.wikimedia.org/r/64067
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib1d6b79efe25e5d144ea5f949b810c002f53b600
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DataValues
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Denny Vrandecic <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits