@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | /** |
27 | 27 | * @param Table $value |
28 | - * @return mixed |
|
28 | + * @return string |
|
29 | 29 | */ |
30 | 30 | public function render($value) { |
31 | 31 | $climate = new CLImate(); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | /** |
78 | 78 | * @param Table $table |
79 | - * @return mixed |
|
79 | + * @return string[] |
|
80 | 80 | */ |
81 | 81 | protected function getHeaders($table) { |
82 | 82 | return $table->getHeaders(); |
@@ -41,7 +41,7 @@ |
||
41 | 41 | /** @var \League\CLImate\Util\Writer\Buffer $buffer */ |
42 | 42 | $buffer = $climate->output->get('buffer'); |
43 | 43 | |
44 | - return PHP_EOL . $buffer->get(); |
|
44 | + return PHP_EOL.$buffer->get(); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -105,7 +105,7 @@ |
||
105 | 105 | |
106 | 106 | /** |
107 | 107 | * @param Parameter $parameter |
108 | - * @return array|Element[] |
|
108 | + * @return Element[] |
|
109 | 109 | */ |
110 | 110 | public function headElements(Parameter $parameter) { |
111 | 111 | return [ |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | new Element("input", array_merge([ |
61 | 61 | 'class' => 'sr-only file-input', |
62 | 62 | 'type' => 'file', |
63 | - 'name' => $parameter->getName() . '[file]' |
|
63 | + 'name' => $parameter->getName().'[file]' |
|
64 | 64 | ], $parameter->isRequired() && is_null($value) ? [ |
65 | 65 | 'required' => 'required' |
66 | 66 | ] : [])) |
@@ -84,17 +84,17 @@ discard block |
||
84 | 84 | return (string)new Element('p', [], [ |
85 | 85 | new Element('input', [ |
86 | 86 | 'type' => 'hidden', |
87 | - 'name' => $parameter->getName() . '[name]', |
|
87 | + 'name' => $parameter->getName().'[name]', |
|
88 | 88 | 'value' => $file->getName() |
89 | 89 | ]), |
90 | 90 | new Element('input', [ |
91 | 91 | 'type' => 'hidden', |
92 | - 'name' => $parameter->getName() . '[type]', |
|
92 | + 'name' => $parameter->getName().'[type]', |
|
93 | 93 | 'value' => $file->getType() |
94 | 94 | ]), |
95 | 95 | new Element('input', [ |
96 | 96 | 'type' => 'hidden', |
97 | - 'name' => $parameter->getName() . '[data]', |
|
97 | + 'name' => $parameter->getName().'[data]', |
|
98 | 98 | 'value' => base64_encode($file->getContent()) |
99 | 99 | ]), |
100 | 100 | (new FileRenderer())->render($file) |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | - * @return array|int[] |
|
39 | + * @return integer[] |
|
40 | 40 | */ |
41 | 41 | protected function getRotatingAngles() { |
42 | 42 | return [15, 90]; |
@@ -162,6 +162,11 @@ discard block |
||
162 | 162 | }, $this->getRotatingAngles()); |
163 | 163 | } |
164 | 164 | |
165 | + /** |
|
166 | + * @param string $glyphIcon |
|
167 | + * @param string $title |
|
168 | + * @param string $onClick |
|
169 | + */ |
|
165 | 170 | protected function renderIconButton($glyphIcon, $title, $onClick) { |
166 | 171 | return $this->renderButton(new Element('span', ['class' => 'glyphicon glyphicon-' . $glyphIcon]), $title, $onClick); |
167 | 172 | } |
@@ -176,7 +181,7 @@ discard block |
||
176 | 181 | |
177 | 182 | /** |
178 | 183 | * @param Parameter $parameter |
179 | - * @return array|\rtens\domin\delivery\web\Element[] |
|
184 | + * @return Element[] |
|
180 | 185 | */ |
181 | 186 | public function headElements(Parameter $parameter) { |
182 | 187 | $script = file_get_contents(__DIR__ . '/js/ImageField.js'); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function render(Parameter $parameter, $value) { |
88 | 88 | return |
89 | - $this->renderImagePreservation($parameter, $value ? $value->getFile() : null) . |
|
89 | + $this->renderImagePreservation($parameter, $value ? $value->getFile() : null). |
|
90 | 90 | new Element('div', ['class' => 'image-cropper'], [ |
91 | 91 | new Element('label', [], [ |
92 | 92 | new Element('span', ['class' => 'btn btn-success'], ['Choose Image']), |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | new Element("input", [ |
107 | 107 | 'type' => 'hidden', |
108 | 108 | 'class' => "image-data", |
109 | - 'name' => $parameter->getName() . '[encoded]' |
|
109 | + 'name' => $parameter->getName().'[encoded]' |
|
110 | 110 | ]), |
111 | 111 | |
112 | 112 | new Element('div', ['class' => 'image-container', 'style' => 'display: none;'], [ |
@@ -150,20 +150,20 @@ discard block |
||
150 | 150 | } |
151 | 151 | |
152 | 152 | private function renderAspectRatioButtons() { |
153 | - return array_map(function ($ratio) { |
|
153 | + return array_map(function($ratio) { |
|
154 | 154 | list($nom, $den) = $ratio; |
155 | 155 | return $this->renderButton("$nom:$den", "Fix aspect ratio to $nom:$den", "$(this).setOption('setAspectRatio', $nom/$den)"); |
156 | 156 | }, $this->getAspectRatios()); |
157 | 157 | } |
158 | 158 | |
159 | 159 | private function renderRotationButtons() { |
160 | - return array_map(function ($angle) { |
|
160 | + return array_map(function($angle) { |
|
161 | 161 | return $this->renderButton("$angle°", "Rotate by $angle degree", "$(this).setOption('rotate', $angle)"); |
162 | 162 | }, $this->getRotatingAngles()); |
163 | 163 | } |
164 | 164 | |
165 | 165 | protected function renderIconButton($glyphIcon, $title, $onClick) { |
166 | - return $this->renderButton(new Element('span', ['class' => 'glyphicon glyphicon-' . $glyphIcon]), $title, $onClick); |
|
166 | + return $this->renderButton(new Element('span', ['class' => 'glyphicon glyphicon-'.$glyphIcon]), $title, $onClick); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | protected function renderButton($caption, $title, $onClick) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @return array|\rtens\domin\delivery\web\Element[] |
180 | 180 | */ |
181 | 181 | public function headElements(Parameter $parameter) { |
182 | - $script = file_get_contents(__DIR__ . '/js/ImageField.js'); |
|
182 | + $script = file_get_contents(__DIR__.'/js/ImageField.js'); |
|
183 | 183 | |
184 | 184 | $script = str_replace( |
185 | 185 | '$cropperOptions$', |
@@ -106,7 +106,7 @@ |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
109 | - * @param array|Element[] $rightHeading |
|
109 | + * @param Element[] $rightHeading |
|
110 | 110 | * @return static |
111 | 111 | */ |
112 | 112 | public function setRightHeading(array $rightHeading) { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if ($this->maxHeight) { |
49 | 49 | $content[] = new Element('div', [ |
50 | 50 | 'class' => 'panel-body', |
51 | - 'style' => 'overflow-x: auto; overflow-y: hidden; max-height: ' . $this->maxHeight, |
|
51 | + 'style' => 'overflow-x: auto; overflow-y: hidden; max-height: '.$this->maxHeight, |
|
52 | 52 | 'data-maxheight' => $this->maxHeight |
53 | 53 | ], [ |
54 | 54 | $renderers->getRenderer($this->content)->render($this->content) |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | new Element('div', ['class' => 'pull-right'], [ |
58 | 58 | new Element('a', [ |
59 | 59 | 'href' => 'javascript:', |
60 | - 'onclick' => "var body = $(this).closest('.panel').find('.panel-body');" . |
|
61 | - "body.css('max-height', 'none');" . |
|
62 | - "body.css('overflow-y', 'visible');" . |
|
63 | - "$(this).hide(); " . |
|
60 | + 'onclick' => "var body = $(this).closest('.panel').find('.panel-body');". |
|
61 | + "body.css('max-height', 'none');". |
|
62 | + "body.css('overflow-y', 'visible');". |
|
63 | + "$(this).hide(); ". |
|
64 | 64 | "$(this).next().show();", |
65 | 65 | 'class' => 'show-all' |
66 | 66 | ], [ |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | ]), |
70 | 70 | new Element('a', [ |
71 | 71 | 'href' => 'javascript:', |
72 | - 'onclick' => "var body = $(this).closest('.panel').find('.panel-body');" . |
|
73 | - "body.css('max-height', body.data('maxheight'));" . |
|
74 | - "body.css('overflow-y', 'hidden');" . |
|
75 | - "$(this).hide();" . |
|
72 | + 'onclick' => "var body = $(this).closest('.panel').find('.panel-body');". |
|
73 | + "body.css('max-height', body.data('maxheight'));". |
|
74 | + "body.css('overflow-y', 'hidden');". |
|
75 | + "$(this).hide();". |
|
76 | 76 | "$(this).prev().show();", |
77 | 77 | 'class' => 'show-less', |
78 | 78 | 'style' => 'display: none' |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | /** |
26 | 26 | * @param array $value |
27 | - * @return mixed |
|
27 | + * @return string |
|
28 | 28 | */ |
29 | 29 | public function render($value) { |
30 | 30 | $items = []; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @param array $array |
32 | - * @return mixed |
|
32 | + * @return Element |
|
33 | 33 | */ |
34 | 34 | public function render($array) { |
35 | 35 | $content = [ |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @param Table $value |
33 | - * @return mixed |
|
33 | + * @return null|string |
|
34 | 34 | */ |
35 | 35 | public function render($value) { |
36 | 36 | $rows = $this->renderRows($value); |
@@ -44,6 +44,9 @@ discard block |
||
44 | 44 | ], $rows)); |
45 | 45 | } |
46 | 46 | |
47 | + /** |
|
48 | + * @param Table $table |
|
49 | + */ |
|
47 | 50 | private function renderHeaders($table) { |
48 | 51 | $headers = [new Element('th', ['width' => '1'])]; |
49 | 52 | foreach ($this->getHeaders($table) as $caption) { |
@@ -89,7 +92,7 @@ discard block |
||
89 | 92 | |
90 | 93 | /** |
91 | 94 | * @param Table $table |
92 | - * @return mixed |
|
95 | + * @return string[] |
|
93 | 96 | */ |
94 | 97 | protected function getHeaders($table) { |
95 | 98 | return $table->getHeaders(); |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use rtens\domin\delivery\web\Element; |
6 | 6 | use rtens\domin\delivery\web\renderers\link\LinkPrinter; |
7 | 7 | use rtens\domin\delivery\web\WebRenderer; |
8 | -use watoki\reflect\Property; |
|
9 | 8 | |
10 | 9 | class TableRenderer implements WebRenderer { |
11 | 10 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | * @return array|string[] |
42 | 42 | */ |
43 | 43 | public static function filter(array $headElements) { |
44 | - return array_values(array_unique(array_map(function (Element $element) { |
|
44 | + return array_values(array_unique(array_map(function(Element $element) { |
|
45 | 45 | return (string)$element; |
46 | 46 | }, $headElements))); |
47 | 47 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | public function __construct($content) { |
16 | 16 | if (!is_callable($content)) { |
17 | - $content = function () use ($content) { |
|
17 | + $content = function() use ($content) { |
|
18 | 18 | return $content; |
19 | 19 | }; |
20 | 20 | } |