1 | <?php |
||
32 | abstract class AbstractDataTablesTwigExtension extends AbstractTwigExtension { |
||
33 | |||
34 | use RendererTwigExtensionTrait; |
||
35 | use TwigEnvironmentTrait; |
||
36 | |||
37 | /** |
||
38 | * jQuery DataTables. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | const JQUERY_DATATABLES = <<< EOT |
||
43 | $(document).ready(function () { |
||
44 | var %var% = $("%selector%").DataTable(%options%); |
||
45 | }); |
||
46 | EOT; |
||
47 | |||
48 | /** |
||
49 | * jQuery DataTables. |
||
50 | * |
||
51 | * @var string |
||
52 | */ |
||
53 | const JQUERY_DATATABLES_STANDALONE = <<< EOT |
||
54 | $(document).ready(function () { |
||
55 | $("%selector%").DataTable(%options%); |
||
56 | }); |
||
57 | EOT; |
||
58 | |||
59 | /** |
||
60 | * Constructor. |
||
61 | * |
||
62 | * @param Environment $twigEnvironment The Twig environment. |
||
63 | * @param RendererTwigExtension $rendererTwigExtension The renderer Twig extension. |
||
64 | */ |
||
65 | public function __construct(Environment $twigEnvironment, RendererTwigExtension $rendererTwigExtension) { |
||
69 | |||
70 | /** |
||
71 | * Encode the options. |
||
72 | * |
||
73 | * @param array $options The options. |
||
74 | * @return string Returns the encoded options. |
||
75 | */ |
||
76 | protected function encodeOptions(array $options) { |
||
84 | |||
85 | /** |
||
86 | * Displays a jQuery DataTables. |
||
87 | * |
||
88 | * @param DataTablesWrapperInterface $dtWrapper The wrapper. |
||
89 | * @param string $selector The selector. |
||
90 | * @param string $language The language. |
||
91 | * @return string Returns the jQuery DataTables. |
||
92 | * @throws FileNotFoundException Throws a file not found exception if the language file does not exist. |
||
93 | */ |
||
94 | protected function jQueryDataTables(DataTablesWrapperInterface $dtWrapper, $selector, $language) { |
||
110 | |||
111 | /** |
||
112 | * Displays a jQuery DataTables "standalone". |
||
113 | * |
||
114 | * @param string $selector The selector. |
||
115 | * @param string $language The language. |
||
116 | * @param array $options The options. |
||
117 | * @return string Returns the jQuery DataTables "Standalone". |
||
118 | * @throws FileNotFoundException Throws a file not found exception if the language file does not exist. |
||
119 | */ |
||
120 | protected function jQueryDataTablesStandalone($selector, $language, array $options) { |
||
132 | |||
133 | /** |
||
134 | * Render a DataTables. |
||
135 | * |
||
136 | * @param DataTablesWrapperInterface $dtWrapper The wrapper. |
||
137 | * @param string $class The class. |
||
138 | * @param boolean $includeTHead Include thead ? |
||
139 | * @param boolean $includeTFoot Include tfoot ? |
||
140 | * @return string Returns the rendered DataTables. |
||
141 | */ |
||
142 | protected function renderDataTables(DataTablesWrapperInterface $dtWrapper, $class, $includeTHead, $includeTFoot) { |
||
156 | |||
157 | /** |
||
158 | * Render a column. |
||
159 | * |
||
160 | * @param DataTablesColumnInterface $dtColumn The column. |
||
161 | * @param bool $rowScope Row scope ? |
||
162 | * @return string Returns the rendered column. |
||
163 | */ |
||
164 | private function renderDataTablesColumn(DataTablesColumnInterface $dtColumn, $rowScope = false) { |
||
174 | |||
175 | /** |
||
176 | * Render a row. |
||
177 | * |
||
178 | * @param DataTablesWrapperInterface $dtWrapper The wrapper. |
||
179 | * @param string $wrapper The wrapper (thead or tfoot) |
||
180 | * @return string Returns the rendered row. |
||
181 | */ |
||
182 | private function renderDataTablesRow(DataTablesWrapperInterface $dtWrapper, $wrapper) { |
||
203 | } |
||
204 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.