1<?php 2 3declare(strict_types=1); 4 5namespace JMS\Serializer\Twig; 6 7/** 8 * @author Asmir Mustafic <goetas@gmail.com> 9 */ 10final class SerializerRuntimeExtension extends \Twig_Extension 11{ 12 /** 13 * @return string 14 * 15 * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint 16 */ 17 public function getName() 18 { 19 return 'jms_serializer'; 20 } 21 22 /** 23 * @return \Twig_Filter[] 24 * 25 * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint 26 */ 27 public function getFilters() 28 { 29 return [ 30 new \Twig_SimpleFilter('serialize', [SerializerRuntimeHelper::class, 'serialize']), 31 ]; 32 } 33 34 /** 35 * @return \Twig_Function[] 36 * 37 * @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint 38 */ 39 public function getFunctions() 40 { 41 return [ 42 new \Twig_SimpleFunction('serialization_context', '\JMS\Serializer\SerializationContext::create'), 43 ]; 44 } 45} 46