1 | <?php |
||
40 | class LuaLibrary extends Scribunto_LuaLibraryBase { |
||
41 | |||
42 | /** |
||
43 | * @var ApplicationFactory $applicationFactory; |
||
44 | */ |
||
45 | private $applicationFactory; |
||
46 | |||
47 | /** |
||
48 | * LuaLibrary constructor. |
||
49 | * |
||
50 | * @param Scribunto_LuaEngine $engine |
||
51 | */ |
||
52 | 19 | public function __construct( $engine ) { |
|
56 | |||
57 | /** |
||
58 | * @return array |
||
59 | */ |
||
60 | 11 | public function register() { |
|
61 | |||
62 | $lib = [ |
||
63 | 11 | 'parse' => [ $this, 'parse' ], |
|
64 | 11 | 'getSkin' => [ $this, 'getSkin' ], |
|
65 | 11 | ]; |
|
66 | |||
67 | 11 | return $this->getEngine()->registerInterface( __DIR__ . '/../lua/mw.bootstrap.lua', $lib, [] ); |
|
68 | } |
||
69 | |||
70 | /** |
||
71 | * @param string $componentName |
||
72 | * @param string $input |
||
73 | * @param array $arguments |
||
74 | * |
||
75 | * @throws \ReflectionException |
||
76 | * @throws \MWException |
||
77 | * |
||
78 | * @return string[] |
||
79 | */ |
||
80 | 8 | public function parse( $componentName, $input, $arguments ) { |
|
96 | |||
97 | /** |
||
98 | * @throws \MWException |
||
99 | * |
||
100 | * @return string[] |
||
101 | */ |
||
102 | 4 | public function getSkin() { |
|
105 | |||
106 | /** |
||
107 | * @param string $input |
||
108 | * @param array $arguments |
||
109 | * @param null|string $component |
||
110 | * |
||
111 | * @throws \MWException |
||
112 | * |
||
113 | * @return \BootstrapComponents\ParserRequest |
||
114 | */ |
||
115 | 4 | protected function buildParserRequest( $input, $arguments, $component = null ) { |
|
124 | |||
125 | /** |
||
126 | * @param string $componentClass |
||
127 | * |
||
128 | * @throws \MWException |
||
129 | * @throws \ReflectionException |
||
130 | * |
||
131 | * @return AbstractComponent |
||
132 | */ |
||
133 | 4 | protected function getComponent( $componentClass ) { |
|
146 | |||
147 | /** |
||
148 | * @return ApplicationFactory |
||
149 | */ |
||
150 | 8 | protected function getApplicationFactory() { |
|
153 | |||
154 | /** |
||
155 | * Takes the $arguments passed from lua and pre-processes them: make sure, |
||
156 | * we have a sequence array (not associative) |
||
157 | * |
||
158 | * @param string|array $arguments |
||
159 | * |
||
160 | * @return array |
||
161 | */ |
||
162 | 4 | private function processLuaArguments( $arguments ) { |
|
181 | } |