Jeroen De Dauw has uploaded a new change for review.
https://gerrit.wikimedia.org/r/72757
Change subject: Move out (de)serialization code to Serializers [DO NOT MERGE]
......................................................................
Move out (de)serialization code to Serializers [DO NOT MERGE]
Change-Id: I8f5ff0944dfb97a84369476d05a1bc3355e4ce41
---
M Ask.php
M composer.json
M src/Ask/Serializers/DescriptionSerializer.php
M src/Ask/Serializers/QueryOptionsSerializer.php
M src/Ask/Serializers/QuerySerializer.php
M src/Ask/Serializers/SelectionRequestSerializer.php
M src/Ask/Serializers/SortExpressionSerializer.php
D src/Deserializers/Deserializer.php
D src/Deserializers/DispatchingDeserializer.php
D src/Deserializers/Exceptions/DeserializationException.php
D src/Deserializers/Exceptions/InvalidAttributeException.php
D src/Deserializers/Exceptions/MissingAttributeException.php
D src/Deserializers/Exceptions/MissingTypeException.php
D src/Deserializers/Exceptions/UnsupportedTypeException.php
D src/Deserializers/StrategicDeserializer.php
D src/Deserializers/TypedDeserializationStrategy.php
D src/Deserializers/TypedObjectDeserializer.php
D src/Serializers/DispatchingSerializer.php
D src/Serializers/Exceptions/SerializationException.php
D src/Serializers/Exceptions/UnsupportedObjectException.php
D src/Serializers/Serializer.php
21 files changed, 31 insertions(+), 651 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Ask
refs/changes/57/72757/1
diff --git a/Ask.php b/Ask.php
index ee66bb1..a2ac303 100644
--- a/Ask.php
+++ b/Ask.php
@@ -35,9 +35,9 @@
define( 'Ask_VERSION', '0.1 alpha' );
-// Attempt to include the DataValues lib if that hasn't been done yet.
+// Attempt to include the dependencies if one has not been loaded yet.
// This is the path to the autoloader generated by composer in case of a
composer install.
-if ( !defined( 'DataValues_VERSION' ) && is_readable( __DIR__ .
'/vendor/autoload.php' ) ) {
+if ( ( !defined( 'DataValues_VERSION' ) || !defined( 'Serialization_VERSION' )
) && is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
include_once( __DIR__ . '/vendor/autoload.php' );
}
@@ -47,9 +47,20 @@
include_once( __DIR__ . '/../DataValues/DataValues.php' );
}
+// Attempt to include the Serialization lib if that hasn't been done yet.
+// This is the path the Serialization entry point will be at when loaded as
MediaWiki extension.
+if ( !defined( 'Serialization_VERSION' ) && is_readable( __DIR__ .
'/../Serialization/Serialization.php' ) ) {
+ include_once( __DIR__ . '/../Serialization/Serialization.php' );
+}
+
// Only initialize the extension when all dependencies are present.
if ( !defined( 'DataValues_VERSION' ) ) {
throw new Exception( 'You need to have the DataValues library loaded in
order to use Ask' );
+}
+
+// Only initialize the extension when all dependencies are present.
+if ( !defined( 'Serialization_VERSION' ) ) {
+ throw new Exception( 'You need to have the Serialization library loaded
in order to use Ask' );
}
// @codeCoverageIgnoreStart
@@ -68,7 +79,7 @@
$namespaceSegments = explode( '\\', $namespace );
- if ( $namespaceSegments[0] === 'Ask' || $namespaceSegments[0] ===
'Serializers' || $namespaceSegments[0] === 'Deserializers' ) {
+ if ( $namespaceSegments[0] === 'Ask' ) {
if ( count( $namespaceSegments ) === 1 || $namespaceSegments[1]
!== 'Tests' ) {
require_once __DIR__ . '/src/' . $fileName;
}
diff --git a/composer.json b/composer.json
index ea26525..71fd0e1 100644
--- a/composer.json
+++ b/composer.json
@@ -26,9 +26,9 @@
},
"require": {
"php": ">=5.3.0",
- "data-values/data-values": "dev-master"
+ "data-values/data-values": "@dev",
+ "serialization/serialization": ">=1.0@dev"
},
- "minimum-stability" : "dev",
"autoload": {
"files" : [
"Ask.php"
diff --git a/src/Ask/Serializers/DescriptionSerializer.php
b/src/Ask/Serializers/DescriptionSerializer.php
index 4186458..3415c62 100644
--- a/src/Ask/Serializers/DescriptionSerializer.php
+++ b/src/Ask/Serializers/DescriptionSerializer.php
@@ -21,9 +21,9 @@
*/
class DescriptionSerializer implements Serializer {
- public function serialize( $askObject ) {
- $this->assertCanSerialize( $askObject );
- return $this->getSerializedDescription( $askObject );
+ public function serialize( $object ) {
+ $this->assertCanSerialize( $object );
+ return $this->getSerializedDescription( $object );
}
protected function getSerializedDescription( Description $description )
{
diff --git a/src/Ask/Serializers/QueryOptionsSerializer.php
b/src/Ask/Serializers/QueryOptionsSerializer.php
index 21e9d7e..82d277b 100644
--- a/src/Ask/Serializers/QueryOptionsSerializer.php
+++ b/src/Ask/Serializers/QueryOptionsSerializer.php
@@ -28,9 +28,9 @@
$this->componentSerializer = $componentSerializer;
}
- public function serialize( $askObject ) {
- $this->assertCanSerialize( $askObject );
- return $this->getSerializedOptions( $askObject );
+ public function serialize( $object ) {
+ $this->assertCanSerialize( $object );
+ return $this->getSerializedOptions( $object );
}
protected function assertCanSerialize( $askObject ) {
diff --git a/src/Ask/Serializers/QuerySerializer.php
b/src/Ask/Serializers/QuerySerializer.php
index d80ab93..bc38363 100644
--- a/src/Ask/Serializers/QuerySerializer.php
+++ b/src/Ask/Serializers/QuerySerializer.php
@@ -27,10 +27,10 @@
$this->componentSerializer = $componentSerializer;
}
- public function serialize( $askObject ) {
- $this->assertCanSerialize( $askObject );
+ public function serialize( $object ) {
+ $this->assertCanSerialize( $object );
- return $this->getSerializedQuery( $askObject );
+ return $this->getSerializedQuery( $object );
}
protected function assertCanSerialize( $askObject ) {
diff --git a/src/Ask/Serializers/SelectionRequestSerializer.php
b/src/Ask/Serializers/SelectionRequestSerializer.php
index d2c3e82..7e23917 100644
--- a/src/Ask/Serializers/SelectionRequestSerializer.php
+++ b/src/Ask/Serializers/SelectionRequestSerializer.php
@@ -19,9 +19,9 @@
*/
class SelectionRequestSerializer implements Serializer {
- public function serialize( $askObject ) {
- $this->assertCanSerialize( $askObject );
- return $this->getSerializedSelectionRequest( $askObject );
+ public function serialize( $object ) {
+ $this->assertCanSerialize( $object );
+ return $this->getSerializedSelectionRequest( $object );
}
protected function assertCanSerialize( $askObject ) {
diff --git a/src/Ask/Serializers/SortExpressionSerializer.php
b/src/Ask/Serializers/SortExpressionSerializer.php
index a8a2acc..0f24c97 100644
--- a/src/Ask/Serializers/SortExpressionSerializer.php
+++ b/src/Ask/Serializers/SortExpressionSerializer.php
@@ -18,9 +18,9 @@
*/
class SortExpressionSerializer implements Serializer {
- public function serialize( $askObject ) {
- $this->assertCanSerialize( $askObject );
- return $this->getSerializedSortExpression( $askObject );
+ public function serialize( $object ) {
+ $this->assertCanSerialize( $object );
+ return $this->getSerializedSortExpression( $object );
}
protected function assertCanSerialize( $askObject ) {
diff --git a/src/Deserializers/Deserializer.php
b/src/Deserializers/Deserializer.php
deleted file mode 100644
index 7c06a46..0000000
--- a/src/Deserializers/Deserializer.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-
-namespace Deserializers;
-
-use Deserializers\Exceptions\DeserializationException;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-interface Deserializer {
-
- /**
- * @since 0.1
- *
- * @param mixed $serialization
- *
- * @return object
- * @throws DeserializationException
- */
- public function deserialize( $serialization );
-
- /**
- * Returns if the deserializer can deserialzie the provided object.
- *
- * Note: deserializers are expected to do checks to verify the provided
- * object is of a type they can deserialize. No full deserialization is
- * attempted. Thus when providing invalid data structures, it is
possible
- * this method returns true even though deserialization will fail.
- *
- * @since 0.1
- *
- * @param mixed $serialization
- *
- * @return boolean
- */
- public function canDeserialize( $serialization );
-
-}
diff --git a/src/Deserializers/DispatchingDeserializer.php
b/src/Deserializers/DispatchingDeserializer.php
deleted file mode 100644
index 66eca22..0000000
--- a/src/Deserializers/DispatchingDeserializer.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-
-namespace Deserializers;
-
-use Deserializers\Exceptions\DeserializationException;
-use InvalidArgumentException;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class DispatchingDeserializer implements Deserializer {
-
- /**
- * @var Deserializer[]
- */
- protected $deserializers;
-
- /**
- * @param Deserializer[] $deserializers
- */
- public function __construct( array $deserializers = array() ) {
- $this->assertAreDeserializers( $deserializers );
- $this->deserializers = $deserializers;
- }
-
- protected function assertAreDeserializers( array $deserializers ) {
- foreach ( $deserializers as $deserializer ) {
- if ( !is_object( $deserializer ) || !( $deserializer
instanceof Deserializer ) ) {
- throw new InvalidArgumentException( 'All
$deserializers need to implement the Deserializer interface' );
- }
- }
- }
-
- public function deserialize( $serialization ) {
- foreach ( $this->deserializers as $deserializer ) {
- if ( $deserializer->canDeserialize( $serialization ) ) {
- return $deserializer->deserialize(
$serialization );
- }
- }
-
- throw new DeserializationException(
- 'None of the deserializers can deserialize the provided
serialization'
- );
- }
-
- public function canDeserialize( $serialization ) {
- foreach ( $this->deserializers as $deserializer ) {
- if ( $deserializer->canDeserialize( $serialization ) ) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * @since 0.1
- *
- * @param Deserializer $serializer
- */
- public function addDeserializer( Deserializer $serializer ) {
- $this->deserializers[] = $serializer;
- }
-
-}
diff --git a/src/Deserializers/Exceptions/DeserializationException.php
b/src/Deserializers/Exceptions/DeserializationException.php
deleted file mode 100644
index 1ca732f..0000000
--- a/src/Deserializers/Exceptions/DeserializationException.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-namespace Deserializers\Exceptions;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class DeserializationException extends \RuntimeException {
-
- public function __construct( $message = '', \Exception $previous = null
) {
- parent::__construct( $message, 0, $previous );
- }
-
-}
diff --git a/src/Deserializers/Exceptions/InvalidAttributeException.php
b/src/Deserializers/Exceptions/InvalidAttributeException.php
deleted file mode 100644
index 16a54c0..0000000
--- a/src/Deserializers/Exceptions/InvalidAttributeException.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-namespace Deserializers\Exceptions;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class InvalidAttributeException extends DeserializationException {
-
- protected $attributeName;
- protected $attributeValue;
-
- /**
- * @param string $attributeName
- * @param mixed $attributeValue
- * @param string $message
- * @param \Exception $previous
- */
- public function __construct( $attributeName, $attributeValue, $message
= '', \Exception $previous = null ) {
- $this->attributeName = $attributeName;
- $this->attributeValue = $attributeValue;
-
- parent::__construct( $message, $previous );
- }
-
- /**
- * @return string
- */
- public function getAttributeName() {
- return $this->attributeName;
- }
-
- /**
- * @return string
- */
- public function getAttributeValue() {
- return $this->attributeValue;
- }
-
-}
diff --git a/src/Deserializers/Exceptions/MissingAttributeException.php
b/src/Deserializers/Exceptions/MissingAttributeException.php
deleted file mode 100644
index 930ace9..0000000
--- a/src/Deserializers/Exceptions/MissingAttributeException.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-namespace Deserializers\Exceptions;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class MissingAttributeException extends DeserializationException {
-
- protected $attributeName;
-
- /**
- * @param string $attributeName
- * @param string $message
- * @param \Exception $previous
- */
- public function __construct( $attributeName, $message = '', \Exception
$previous = null ) {
- $this->attributeName = $attributeName;
-
- parent::__construct( $message, $previous );
- }
-
- /**
- * @return string
- */
- public function getAttributeName() {
- return $this->attributeName;
- }
-
-}
diff --git a/src/Deserializers/Exceptions/MissingTypeException.php
b/src/Deserializers/Exceptions/MissingTypeException.php
deleted file mode 100644
index 389b8cf..0000000
--- a/src/Deserializers/Exceptions/MissingTypeException.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-namespace Deserializers\Exceptions;
-
-/**
- * Indicates the objectType key is missing in the serialization.
- *
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class MissingTypeException extends DeserializationException {
-
- protected $unsupportedType;
-
- /**
- * @param string $message
- * @param \Exception $previous
- */
- public function __construct( $message = '', \Exception $previous = null
) {
- parent::__construct( $message, $previous );
- }
-
-}
diff --git a/src/Deserializers/Exceptions/UnsupportedTypeException.php
b/src/Deserializers/Exceptions/UnsupportedTypeException.php
deleted file mode 100644
index 0fd6efa..0000000
--- a/src/Deserializers/Exceptions/UnsupportedTypeException.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-namespace Deserializers\Exceptions;
-
-/**
- * Indicates the objectType specified in the serialization is not supported by
a deserializer.
- *
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class UnsupportedTypeException extends DeserializationException {
-
- protected $unsupportedType;
-
- /**
- * @param mixed $unsupportedType
- * @param string $message
- * @param \Exception $previous
- */
- public function __construct( $unsupportedType, $message = '',
\Exception $previous = null ) {
- $this->unsupportedType = $unsupportedType;
-
- parent::__construct( $message, $previous );
- }
-
- /**
- * @return mixed
- */
- public function getUnsupportedType() {
- return $this->unsupportedType;
- }
-
-}
diff --git a/src/Deserializers/StrategicDeserializer.php
b/src/Deserializers/StrategicDeserializer.php
deleted file mode 100644
index 553f120..0000000
--- a/src/Deserializers/StrategicDeserializer.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-
-namespace Deserializers;
-
-use Deserializers\TypedDeserializationStrategy;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class StrategicDeserializer extends TypedObjectDeserializer {
-
- protected $deserializationStrategy;
- protected $subTypeKey;
-
- /**
- * @param TypedDeserializationStrategy $deserializationStrategy
- * @param string $objectType The objectType that is supported. For
instance "description" or "selectionRequest".
- * @param string $subTypeKey The name of the key used for the specific
type of object. For instance "descriptionType" or "sortExpressionType".
- */
- public function __construct( TypedDeserializationStrategy
$deserializationStrategy, $objectType, $subTypeKey ) {
- $this->deserializationStrategy = $deserializationStrategy;
- $this->subTypeKey = $subTypeKey;
-
- parent::__construct( $objectType );
- }
-
- public function deserialize( $serialization ) {
- $this->assertCanDeserialize( $serialization );
- return $this->getDeserialization( $serialization );
- }
-
- protected function getDeserialization( array $serialization ) {
- $this->requireAttribute( $serialization, $this->subTypeKey );
- $this->requireAttributes( $serialization, 'value' );
- $this->assertAttributeIsArray( $serialization, 'value' );
-
- $specificType = $serialization[$this->subTypeKey];
- $valueSerialization = $serialization['value'];
-
- return $this->deserializationStrategy->getDeserializedValue(
$specificType, $valueSerialization );
- }
-
-}
diff --git a/src/Deserializers/TypedDeserializationStrategy.php
b/src/Deserializers/TypedDeserializationStrategy.php
deleted file mode 100644
index 758423f..0000000
--- a/src/Deserializers/TypedDeserializationStrategy.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-namespace Deserializers;
-
-use Deserializers\Exceptions\DeserializationException;
-use Deserializers\Exceptions\InvalidAttributeException;
-use Deserializers\Exceptions\MissingAttributeException;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-abstract class TypedDeserializationStrategy {
-
- /**
- * Deserializes the value serialization into an object.
- *
- * @since 0.1
- *
- * @param string $specificType
- * @param array $valueSerialization
- *
- * @return object
- * @throws DeserializationException
- */
- public abstract function getDeserializedValue( $specificType, array
$valueSerialization );
-
- protected function requireAttribute( array $array, $attributeName ) {
- if ( !array_key_exists( $attributeName, $array ) ) {
- throw new MissingAttributeException(
- $attributeName
- );
- }
- }
-
- protected function assertAttributeIsArray( array $array, $attributeName
) {
- if ( !is_array( $array[$attributeName] ) ) {
- throw new InvalidAttributeException(
- $attributeName,
- $array[$attributeName]
- );
- }
- }
-
- protected function requireAttributes( array $array ) {
- $requiredAttributes = func_get_args();
- array_shift( $requiredAttributes );
-
- foreach ( $requiredAttributes as $attribute ) {
- $this->requireAttribute( $array, $attribute );
- }
- }
-
-}
diff --git a/src/Deserializers/TypedObjectDeserializer.php
b/src/Deserializers/TypedObjectDeserializer.php
deleted file mode 100644
index b436bca..0000000
--- a/src/Deserializers/TypedObjectDeserializer.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-
-namespace Deserializers;
-
-use Deserializers\Exceptions\InvalidAttributeException;
-use Deserializers\Exceptions\MissingAttributeException;
-use Deserializers\Exceptions\MissingTypeException;
-use Deserializers\Exceptions\UnsupportedTypeException;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-abstract class TypedObjectDeserializer implements Deserializer {
-
- protected $objectType;
-
- public function __construct( $objectType ) {
- $this->objectType = $objectType;
- }
-
- protected function assertCanDeserialize( $serialization ) {
- if ( !$this->hasObjectType( $serialization ) ) {
- throw new MissingTypeException();
- }
-
- if ( !$this->hasCorrectObjectType( $serialization ) ) {
- throw new UnsupportedTypeException(
$serialization['objectType'] );
- }
- }
-
- public function canDeserialize( $serialization ) {
- return $this->hasObjectType( $serialization ) &&
$this->hasCorrectObjectType( $serialization );
- }
-
- private function hasCorrectObjectType( $serialization ) {
- return $serialization['objectType'] === $this->objectType;
- }
-
- private function hasObjectType( $serialization ) {
- return is_array( $serialization )
- && array_key_exists( 'objectType', $serialization );
- }
-
- protected function requireAttributes( array $array ) {
- $requiredAttributes = func_get_args();
- array_shift( $requiredAttributes );
-
- foreach ( $requiredAttributes as $attribute ) {
- $this->requireAttribute( $array, $attribute );
- }
- }
-
- protected function requireAttribute( array $array, $attributeName ) {
- if ( !array_key_exists( $attributeName, $array ) ) {
- throw new MissingAttributeException(
- $attributeName
- );
- }
- }
-
- protected function assertAttributeIsArray( array $array, $attributeName
) {
- $this->assertAttributeInternalType( $array, $attributeName,
'array' );
- }
-
- protected function assertAttributeInternalType( array $array,
$attributeName, $internalType ) {
- if ( gettype( $array[$attributeName] ) !== $internalType ) {
- throw new InvalidAttributeException(
- $attributeName,
- $array[$attributeName],
- "The internal type of attribute
'$attributeName' needs to be '$internalType'"
- );
- }
- }
-
-}
diff --git a/src/Serializers/DispatchingSerializer.php
b/src/Serializers/DispatchingSerializer.php
deleted file mode 100644
index 0354aec..0000000
--- a/src/Serializers/DispatchingSerializer.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-namespace Serializers;
-
-use InvalidArgumentException;
-use Serializers\Exceptions\UnsupportedObjectException;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class DispatchingSerializer implements Serializer {
-
- /**
- * @var Serializer[]
- */
- protected $serializers;
-
- /**
- * @param Serializer[] $serializers
- */
- public function __construct( array $serializers = array() ) {
- $this->assertAreSerializers( $serializers );
- $this->serializers = $serializers;
- }
-
- protected function assertAreSerializers( array $serializers ) {
- foreach ( $serializers as $serializer ) {
- if ( !( $serializer instanceof Serializer ) ) {
- throw new InvalidArgumentException( 'Got an
object that is not an instance of Ask\Serializers\Serializer' );
- }
- }
- }
-
- public function serialize( $askObject ) {
- foreach ( $this->serializers as $serializer ) {
- if ( $serializer->canSerialize( $askObject ) ) {
- return $serializer->serialize( $askObject );
- }
- }
-
- throw new UnsupportedObjectException( $askObject );
- }
-
- public function canSerialize( $askObject ) {
- foreach ( $this->serializers as $serializer ) {
- if ( $serializer->canSerialize( $askObject ) ) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * @since 0.1
- *
- * @param Serializer $serializer
- */
- public function addSerializer( Serializer $serializer ) {
- $this->serializers[] = $serializer;
- }
-
-}
diff --git a/src/Serializers/Exceptions/SerializationException.php
b/src/Serializers/Exceptions/SerializationException.php
deleted file mode 100644
index 02cbc4b..0000000
--- a/src/Serializers/Exceptions/SerializationException.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-namespace Serializers\Exceptions;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-abstract class SerializationException extends \RuntimeException {
-
- public function __construct( $message = '', \Exception $previous = null
) {
- parent::__construct( $message, 0, $previous );
- }
-
-}
diff --git a/src/Serializers/Exceptions/UnsupportedObjectException.php
b/src/Serializers/Exceptions/UnsupportedObjectException.php
deleted file mode 100644
index 106685a..0000000
--- a/src/Serializers/Exceptions/UnsupportedObjectException.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-namespace Serializers\Exceptions;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class UnsupportedObjectException extends SerializationException {
-
- protected $unsupportedObject;
-
- /**
- * @param mixed $unsupportedObject
- * @param string $message
- * @param \Exception $previous
- */
- public function __construct( $unsupportedObject, $message = '',
\Exception $previous = null ) {
- $this->unsupportedObject = $unsupportedObject;
-
- parent::__construct( $message, $previous );
- }
-
- /**
- * @return mixed
- */
- public function getUnsupportedObject() {
- return $this->unsupportedObject;
- }
-
-}
diff --git a/src/Serializers/Serializer.php b/src/Serializers/Serializer.php
deleted file mode 100644
index 98988ff..0000000
--- a/src/Serializers/Serializer.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-namespace Serializers;
-
-/**
- * @since 0.1
- *
- * @file
- * @ingroup Ask
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-interface Serializer {
-
- /**
- * @since 0.1
- *
- * @param mixed $askObject
- *
- * @return array|int|string|bool|float A possibly nested structure
consisting of only arrays and scalar values
- */
- public function serialize( $askObject );
-
- /**
- * @since 0.1
- *
- * @param mixed $askObject
- *
- * @return boolean
- */
- public function canSerialize( $askObject );
-
-}
--
To view, visit https://gerrit.wikimedia.org/r/72757
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f5ff0944dfb97a84369476d05a1bc3355e4ce41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Ask
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits