IdentityMarshaller.php 898 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
  11. use Symfony\Component\Cache\Marshaller\MarshallerInterface;
  12. /**
  13. * @author Ahmed TAILOULOUTE <ahmed.tailouloute@gmail.com>
  14. */
  15. class IdentityMarshaller implements MarshallerInterface
  16. {
  17. public function marshall(array $values, ?array &$failed): array
  18. {
  19. foreach ($values as $key => $value) {
  20. if (!\is_string($value)) {
  21. throw new \LogicException(sprintf('%s accepts only string as data.', __METHOD__));
  22. }
  23. }
  24. return $values;
  25. }
  26. public function unmarshall(string $value): string
  27. {
  28. return $value;
  29. }
  30. }