for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the xAPI package.
*
* (c) Christian Flothmann <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Xabbuh\XApi\Serializer;
use Symfony\Component\Serializer\SerializerInterface;
use Xabbuh\XApi\Model\Statement;
/**
* Serialize and deserialize {@link Statement statements}.
* @author Christian Flothmann <[email protected]>
class StatementSerializer implements StatementSerializerInterface
{
* @var SerializerInterface The underlying serializer
private $serializer;
public function __construct(SerializerInterface $serializer)
$this->serializer = $serializer;
}
* {@inheritDoc}
public function serializeStatement(Statement $statement)
return $this->serializer->serialize($statement, 'json');
public function serializeStatements(array $statements)
return $this->serializer->serialize($statements, 'json');
public function deserializeStatement($data)
return $this->serializer->deserialize(
$data,
'Xabbuh\XApi\Model\Statement',
'json'
);
public function deserializeStatements($data)
'Xabbuh\XApi\Model\Statement[]',