Actualización

This commit is contained in:
Xes
2025-04-10 12:24:57 +02:00
parent 8969cc929d
commit 45420b6f0d
39760 changed files with 4303286 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\Serializer;
use Xabbuh\XApi\Model\Actor;
/**
* Serialize and deserialize {@link Actor actors}.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
interface ActorSerializerInterface
{
/**
* Serializes an actor into a JSON encoded string.
*
* @param Actor $actor The actor to serialize
*
* @return string The serialized actor
*/
public function serializeActor(Actor $actor);
/**
* Parses a serialized actor.
*
* @param string $data The serialized actor
*
* @return Actor The parsed actor
*/
public function deserializeActor($data);
}

View File

@@ -0,0 +1,40 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\Serializer;
use Xabbuh\XApi\Model\DocumentData;
/**
* Serialize and deserialize {@link DocumentData document data}.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
interface DocumentDataSerializerInterface
{
/**
* Serializes document data into a JSON encoded string.
*
* @param DocumentData $data The document data to serialize
*
* @return string The serialized document data
*/
public function serializeDocumentData(DocumentData $data);
/**
* Parses serialized document data.
*
* @param string $data The serialized document data
*
* @return DocumentData The parsed document data
*/
public function deserializeDocumentData($data);
}

View File

@@ -0,0 +1,48 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\Serializer;
/**
* Handles the creation of serializer objects.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
interface SerializerFactoryInterface
{
/**
* Creates a statement serializer.
*
* @return StatementSerializerInterface
*/
public function createStatementSerializer();
/**
* Creates a statement result serializer.
*
* @return StatementResultSerializerInterface
*/
public function createStatementResultSerializer();
/**
* Creates an actor serializer.
*
* @return ActorSerializerInterface
*/
public function createActorSerializer();
/**
* Creates a document data serializer.
*
* @return DocumentDataSerializerInterface
*/
public function createDocumentDataSerializer();
}

View File

@@ -0,0 +1,104 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\Serializer;
/**
* Registry containing all the serializers.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
final class SerializerRegistry implements SerializerRegistryInterface
{
/**
* @var StatementSerializerInterface The statement serializer
*/
private $statementSerializer;
/**
* @var StatementResultSerializerInterface The statement result serializer
*/
private $statementResultSerializer;
/**
* @var ActorSerializerInterface The actor serializer
*/
private $actorSerializer;
/**
* @var DocumentDataSerializerInterface The document data serializer
*/
private $documentDataSerializer;
/**
* {@inheritDoc}
*/
public function setStatementSerializer(StatementSerializerInterface $serializer)
{
$this->statementSerializer = $serializer;
}
/**
* {@inheritDoc}
*/
public function getStatementSerializer()
{
return $this->statementSerializer;
}
/**
* {@inheritDoc}
*/
public function setStatementResultSerializer(StatementResultSerializerInterface $serializer)
{
$this->statementResultSerializer = $serializer;
}
/**
* {@inheritDoc}
*/
public function getStatementResultSerializer()
{
return $this->statementResultSerializer;
}
/**
* {@inheritDoc}
*/
public function setActorSerializer(ActorSerializerInterface $serializer)
{
$this->actorSerializer = $serializer;
}
/**
* {@inheritDoc}
*/
public function getActorSerializer()
{
return $this->actorSerializer;
}
/**
* {@inheritDoc}
*/
public function setDocumentDataSerializer(DocumentDataSerializerInterface $serializer)
{
$this->documentDataSerializer = $serializer;
}
/**
* {@inheritDoc}
*/
public function getDocumentDataSerializer()
{
return $this->documentDataSerializer;
}
}

View File

@@ -0,0 +1,76 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\Serializer;
/**
* Registry containing all the serializers.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
interface SerializerRegistryInterface
{
/**
* Sets the {@link StatementSerializerInterface statement serializer}.
*
* @param StatementSerializerInterface $serializer The serializer
*/
public function setStatementSerializer(StatementSerializerInterface $serializer);
/**
* Returns the {@link StatementSerializerInterface statement serializer}.
*
* @return StatementSerializerInterface|null The serializer
*/
public function getStatementSerializer();
/**
* Sets the {@link StatementResultSerializerInterface statement result serializer}.
*
* @param StatementResultSerializerInterface $serializer The serializer
*/
public function setStatementResultSerializer(StatementResultSerializerInterface $serializer);
/**
* Returns the {@link StatementResultSerializerInterface statement result serializer}.
*
* @return StatementResultSerializerInterface|null The serializer
*/
public function getStatementResultSerializer();
/**
* Sets the {@link ActorSerializerInterface actor serializer}.
*
* @param ActorSerializerInterface $serializer The serializer
*/
public function setActorSerializer(ActorSerializerInterface $serializer);
/**
* Returns the {@link ActorSerializerInterface actor serializer}.
*
* @return ActorSerializerInterface|null The serializer
*/
public function getActorSerializer();
/**
* Sets the {@link DocumentDataSerializerInterface document data serializer}.
*
* @param DocumentDataSerializerInterface $serializer The serializer
*/
public function setDocumentDataSerializer(DocumentDataSerializerInterface $serializer);
/**
* Returns the {@link DocumentDataSerializerInterface document data serializer}.
*
* @return DocumentDataSerializerInterface|null The serializer
*/
public function getDocumentDataSerializer();
}

View File

@@ -0,0 +1,43 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\Serializer;
use Xabbuh\XApi\Model\StatementResult;
/**
* Serialize and deserialize {@link StatementResult statement results}.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
interface StatementResultSerializerInterface
{
/**
* Serializes a statement result into a JSON encoded string.
*
* @param StatementResult $statementResult The statement result to serialize
*
* @return string The serialized statement result
*/
public function serializeStatementResult(StatementResult $statementResult);
/**
* Parses a serialized statement result.
*
* @param string $data The serialized statement result
* @param array $attachments The raw attachment data, a mapping of SHA-2 hashes to attachments data (the data is an
* array with the keys type, the attachment's MIME type, and content, the attachment's raw
* content data)
*
* @return StatementResult The parsed statement result
*/
public function deserializeStatementResult($data, array $attachments = array());
}

View File

@@ -0,0 +1,64 @@
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <christian.flothmann@xabbuh.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\Serializer;
use Xabbuh\XApi\Model\Statement;
/**
* Serialize and deserialize {@link Statement statements}.
*
* @author Christian Flothmann <christian.flothmann@xabbuh.de>
*/
interface StatementSerializerInterface
{
/**
* Serializes a statement into a JSON encoded string.
*
* @param Statement $statement The statement to serialize
*
* @return string The serialized statement
*/
public function serializeStatement(Statement $statement);
/**
* Serializes a collection of statements into a JSON encoded string.
*
* @param Statement[] $statements The statements to serialize
*
* @return string The serialized statements
*/
public function serializeStatements(array $statements);
/**
* Parses a serialized statement.
*
* @param string $data The serialized statement
* @param array $attachments The raw attachment data, a mapping of SHA-2 hashes to attachments data (the data is an
* array with the keys type, the attachment's MIME type, and content, the attachment's raw
* content data)
*
* @return Statement The parsed statement
*/
public function deserializeStatement($data, array $attachments = array());
/**
* Parses a serialized collection of statements.
*
* @param string $data The serialized statements
* @param array $attachments The raw attachment data, a mapping of SHA-2 hashes to attachments data (the data is an
* array with the keys type, the attachment's MIME type, and content, the attachment's raw
* content data)
*
* @return Statement[] The parsed statements
*/
public function deserializeStatements($data, array $attachments = array());
}