for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace CalendarBundle\Serializer;
use CalendarBundle\Entity\Event;
class Serializer implements SerializerInterface
{
/**
* @param Event[] $events
*
* @return string json
*/
public function serialize(array $events): string
$result = [];
foreach ($events as $event) {
$result[] = $event->toArray();
}
return json_encode($result);