Paperyard
Din1355TwigExtension.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Paperyard\Helpers;
4 
5 class Din1355TwigExtension extends \Twig_Extension
6 {
7  public function getFilters()
8  {
9  return array(
10  'din1355' => new \Twig_SimpleFilter('din1355', array($this, 'din1355'))
11  );
12  }
13 
14  public function din1355($value)
15  {
16  if (is_numeric($value)) {
17  return date_format(date_create($value), 'd.m.Y');
18  }
19 
20  return $value;
21  }
22 
23  public function getName()
24  {
25  return 'din1355_extention';
26  }
27 
28 }