1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace ApiGen\Renderer\Latte; |
4: | |
5: | use ApiGen\Renderer\Filter; |
6: | use ApiGen\Renderer\UrlGenerator; |
7: | use Latte; |
8: | |
9: | |
10: | class LatteExtension extends Latte\Extension |
11: | { |
12: | public function __construct( |
13: | protected LatteFunctions $functions, |
14: | protected Filter $filter, |
15: | protected UrlGenerator $url, |
16: | ) { |
17: | } |
18: | |
19: | |
20: | public function getFunctions(): array |
21: | { |
22: | return [ |
23: | 'isClass' => $this->functions->isClass(...), |
24: | 'isInterface' => $this->functions->isInterface(...), |
25: | 'isTrait' => $this->functions->isTrait(...), |
26: | 'isEnum' => $this->functions->isEnum(...), |
27: | |
28: | 'textWidth' => $this->functions->textWidth(...), |
29: | 'htmlWidth' => $this->functions->htmlWidth(...), |
30: | 'highlight' => $this->functions->highlight(...), |
31: | 'shortDescription' => $this->functions->shortDescription(...), |
32: | 'longDescription' => $this->functions->longDescription(...), |
33: | |
34: | 'treePageExists' => $this->filter->filterTreePage(...), |
35: | 'namespacePageExists' => $this->filter->filterNamespacePage(...), |
36: | 'classLikePageExists' => $this->filter->filterClassLikePage(...), |
37: | 'functionPageExists' => $this->filter->filterFunctionPage(...), |
38: | 'sourcePageExists' => $this->filter->filterSourcePage(...), |
39: | |
40: | 'elementName' => $this->functions->elementName(...), |
41: | 'elementShortDescription' => $this->functions->elementShortDescription(...), |
42: | 'elementPageExists' => $this->functions->elementPageExists(...), |
43: | 'elementUrl' => $this->functions->elementUrl(...), |
44: | |
45: | 'relativePath' => $this->url->getRelativePath(...), |
46: | 'assetUrl' => $this->url->getAssetUrl(...), |
47: | 'indexUrl' => $this->url->getIndexUrl(...), |
48: | 'treeUrl' => $this->url->getTreeUrl(...), |
49: | 'namespaceUrl' => $this->url->getNamespaceUrl(...), |
50: | 'classLikeUrl' => $this->url->getClassLikeUrl(...), |
51: | 'classLikeSourceUrl' => $this->url->getClassLikeSourceUrl(...), |
52: | 'memberUrl' => $this->url->getMemberUrl(...), |
53: | 'memberAnchor' => $this->url->getMemberAnchor(...), |
54: | 'memberSourceUrl' => $this->url->getMemberSourceUrl(...), |
55: | 'aliasUrl' => $this->url->getAliasUrl(...), |
56: | 'aliasAnchor' => $this->url->getAliasAnchor(...), |
57: | 'aliasSourceUrl' => $this->url->getAliasSourceUrl(...), |
58: | 'functionUrl' => $this->url->getFunctionUrl(...), |
59: | 'functionSourceUrl' => $this->url->getFunctionSourceUrl(...), |
60: | 'parameterAnchor' => $this->url->getParameterAnchor(...), |
61: | 'sourceUrl' => $this->url->getSourceUrl(...), |
62: | ]; |
63: | } |
64: | |
65: | |
66: | public function getTags(): array |
67: | { |
68: | return [ |
69: | 'pre' => LattePreNode::create(...), |
70: | ]; |
71: | } |
72: | } |
73: | |