1 | <?php |
||
2 | /** |
||
3 | * iCalendar plugin for Craft CMS 3.x |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
4 | * |
||
5 | * Tools for parsing & formatting the RFC 2445 iCalendar (.ics) specification |
||
6 | * |
||
7 | * @link https://nystudio107.com |
||
0 ignored issues
–
show
|
|||
8 | * @copyright Copyright (c) 2018 nystudio107 |
||
0 ignored issues
–
show
|
|||
9 | */ |
||
0 ignored issues
–
show
|
|||
10 | |||
11 | namespace nystudio107\icalendar\twigextensions; |
||
12 | |||
13 | use nystudio107\icalendar\ICalendar; |
||
14 | use Twig\Extension\AbstractExtension as TwigExtension; |
||
15 | use Twig\TwigFilter; |
||
16 | use Twig\TwigFunction; |
||
17 | |||
18 | /** |
||
0 ignored issues
–
show
|
|||
19 | * @author nystudio107 |
||
0 ignored issues
–
show
Content of the @author tag must be in the form "Display Name <[email protected]>"
![]() |
|||
20 | * @package ICalendar |
||
0 ignored issues
–
show
|
|||
21 | * @since 1.0.0 |
||
0 ignored issues
–
show
|
|||
22 | */ |
||
0 ignored issues
–
show
|
|||
23 | class ICalendarTwigExtension extends TwigExtension |
||
24 | { |
||
25 | // Public Methods |
||
26 | // ========================================================================= |
||
27 | |||
28 | /** |
||
0 ignored issues
–
show
|
|||
29 | * @inheritdoc |
||
30 | */ |
||
0 ignored issues
–
show
|
|||
31 | public function getName(): string |
||
32 | { |
||
33 | return 'ICalendar'; |
||
34 | } |
||
35 | |||
36 | /** |
||
0 ignored issues
–
show
|
|||
37 | * @inheritdoc |
||
38 | */ |
||
0 ignored issues
–
show
|
|||
39 | public function getFilters(): array |
||
40 | { |
||
41 | return [ |
||
42 | new TwigFilter('rfc2445', [ICalendar::$variable, 'rfc2445']), |
||
43 | new TwigFilter('parseIcs', [ICalendar::$variable, 'ics']), |
||
44 | ]; |
||
45 | } |
||
46 | |||
47 | /** |
||
0 ignored issues
–
show
|
|||
48 | * @inheritdoc |
||
49 | */ |
||
0 ignored issues
–
show
|
|||
50 | public function getFunctions(): array |
||
51 | { |
||
52 | return [ |
||
53 | new TwigFunction('rfc2445', [ICalendar::$variable, 'rfc2445']), |
||
54 | new TwigFunction('parseIcs', [ICalendar::$variable, 'ics']), |
||
55 | ]; |
||
56 | } |
||
57 | } |
||
58 |