1: <?php
2:
3: namespace PHPixie\Framework;
4:
5: /**
6: * Extensions registry
7: */
8: class Extensions
9: {
10: /**
11: * @type Builder
12: */
13: protected $builder;
14:
15: /**
16: * Constructor
17: * @param Builder $builder
18: */
19: public function __construct($builder)
20: {
21: $this->builder = $builder;
22: }
23:
24: /**
25: * Extensions for the Template component
26: * @return array
27: */
28: public function templateExtensions()
29: {
30: return array(
31: new Extensions\Template\Extension\Debug(
32: $this->components()->debug()
33: ),
34: new Extensions\Template\Extension\RouteTranslator(
35: 'http',
36: $this->builder->http()->routeTranslator()
37: )
38: );
39: }
40:
41: /**
42: * Additional formats for the Template component
43: * @return array
44: */
45: public function templateFormats()
46: {
47: return array();
48: }
49:
50: /**
51: * Provider builders for the Auth component
52: * @return array
53: */
54: public function authProviderBuilders()
55: {
56: return array(
57: $this->buildAuthLogin()->providers(),
58: $this->buildAuthHttp()->providers()
59: );
60: }
61:
62: /**
63: * Login extension for the Auth component
64: * @return \PHPixie\AuthLogin
65: */
66: public function buildAuthLogin()
67: {
68: return new \PHPixie\AuthLogin(
69: $this->components()->security()
70: );
71: }
72:
73: /**
74: * HTTP extension for the Auth component
75: * @return \PHPixie\AuthHTTP
76: */
77: public function buildAuthHttp()
78: {
79: return new \PHPixie\AuthHTTP(
80: $this->components()->security(),
81: $this->builder->context()
82: );
83: }
84:
85: /**
86: * @return Components
87: */
88: protected function components()
89: {
90: return $this->builder->components();
91: }
92: }