@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @subpackage dlf |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Region |
|
24 | -{ |
|
23 | +class Region { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * The identifier of the region |
@@ -105,8 +104,7 @@ discard block |
||
105 | 104 | * |
106 | 105 | * @return void |
107 | 106 | */ |
108 | - public function __construct($id, $region) |
|
109 | - { |
|
107 | + public function __construct($id, $region) { |
|
110 | 108 | $this->id = $id; |
111 | 109 | $this->pageId = $region['pageIdx']; |
112 | 110 | $this->xBeginPosition = $region['ulx']; |
@@ -125,8 +123,7 @@ discard block |
||
125 | 123 | * |
126 | 124 | * @return int The region's identifier |
127 | 125 | */ |
128 | - public function getId() |
|
129 | - { |
|
126 | + public function getId() { |
|
130 | 127 | return $this->id; |
131 | 128 | } |
132 | 129 | |
@@ -137,8 +134,7 @@ discard block |
||
137 | 134 | * |
138 | 135 | * @return int The region's page identifier |
139 | 136 | */ |
140 | - public function getPageId() |
|
141 | - { |
|
137 | + public function getPageId() { |
|
142 | 138 | return $this->pageId; |
143 | 139 | } |
144 | 140 | |
@@ -149,8 +145,7 @@ discard block |
||
149 | 145 | * |
150 | 146 | * @return int The region's horizontal beginning position |
151 | 147 | */ |
152 | - public function getXBeginPosition() |
|
153 | - { |
|
148 | + public function getXBeginPosition() { |
|
154 | 149 | return $this->xBeginPosition; |
155 | 150 | } |
156 | 151 | |
@@ -161,8 +156,7 @@ discard block |
||
161 | 156 | * |
162 | 157 | * @return int The region's horizontal ending position |
163 | 158 | */ |
164 | - public function getXEndPosition() |
|
165 | - { |
|
159 | + public function getXEndPosition() { |
|
166 | 160 | return $this->xEndPosition; |
167 | 161 | } |
168 | 162 | |
@@ -173,8 +167,7 @@ discard block |
||
173 | 167 | * |
174 | 168 | * @return int The region's vertical beginning position |
175 | 169 | */ |
176 | - public function getYBeginPosition() |
|
177 | - { |
|
170 | + public function getYBeginPosition() { |
|
178 | 171 | return $this->yBeginPosition; |
179 | 172 | } |
180 | 173 | |
@@ -185,8 +178,7 @@ discard block |
||
185 | 178 | * |
186 | 179 | * @return int The region's vertical ending position |
187 | 180 | */ |
188 | - public function getYEndPosition() |
|
189 | - { |
|
181 | + public function getYEndPosition() { |
|
190 | 182 | return $this->yEndPosition; |
191 | 183 | } |
192 | 184 | |
@@ -197,8 +189,7 @@ discard block |
||
197 | 189 | * |
198 | 190 | * @return int The region's width |
199 | 191 | */ |
200 | - public function getWidth() |
|
201 | - { |
|
192 | + public function getWidth() { |
|
202 | 193 | return $this->width; |
203 | 194 | } |
204 | 195 | |
@@ -209,8 +200,7 @@ discard block |
||
209 | 200 | * |
210 | 201 | * @return int The region's height |
211 | 202 | */ |
212 | - public function getHeight() |
|
213 | - { |
|
203 | + public function getHeight() { |
|
214 | 204 | return $this->height; |
215 | 205 | } |
216 | 206 | |
@@ -221,8 +211,7 @@ discard block |
||
221 | 211 | * |
222 | 212 | * @return string The region's text |
223 | 213 | */ |
224 | - public function getText() |
|
225 | - { |
|
214 | + public function getText() { |
|
226 | 215 | return $this->text; |
227 | 216 | } |
228 | 217 | } |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @subpackage dlf |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Page |
|
24 | -{ |
|
23 | +class Page { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * The identifier of the page |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | * |
66 | 65 | * @return void |
67 | 66 | */ |
68 | - public function __construct($id, $page) |
|
69 | - { |
|
67 | + public function __construct($id, $page) { |
|
70 | 68 | $this->id = $id; |
71 | 69 | $this->name = $page['id']; |
72 | 70 | $this->width = $page['width']; |
@@ -80,8 +78,7 @@ discard block |
||
80 | 78 | * |
81 | 79 | * @return int The page's identifier |
82 | 80 | */ |
83 | - public function getId() |
|
84 | - { |
|
81 | + public function getId() { |
|
85 | 82 | return $this->id; |
86 | 83 | } |
87 | 84 | |
@@ -92,8 +89,7 @@ discard block |
||
92 | 89 | * |
93 | 90 | * @return string The page's name |
94 | 91 | */ |
95 | - public function getName() |
|
96 | - { |
|
92 | + public function getName() { |
|
97 | 93 | return $this->name; |
98 | 94 | } |
99 | 95 | |
@@ -104,8 +100,7 @@ discard block |
||
104 | 100 | * |
105 | 101 | * @return int The page's width |
106 | 102 | */ |
107 | - public function getWidth() |
|
108 | - { |
|
103 | + public function getWidth() { |
|
109 | 104 | return $this->width; |
110 | 105 | } |
111 | 106 | |
@@ -116,8 +111,7 @@ discard block |
||
116 | 111 | * |
117 | 112 | * @return int The page's height |
118 | 113 | */ |
119 | - public function getHeight() |
|
120 | - { |
|
114 | + public function getHeight() { |
|
121 | 115 | return $this->height; |
122 | 116 | } |
123 | 117 | } |
@@ -28,16 +28,14 @@ discard block |
||
28 | 28 | * @subpackage dlf |
29 | 29 | * @access public |
30 | 30 | */ |
31 | -class SearchInDocument |
|
32 | -{ |
|
31 | +class SearchInDocument { |
|
33 | 32 | /** |
34 | 33 | * The main method of the eID script |
35 | 34 | * |
36 | 35 | * @param ServerRequestInterface $request |
37 | 36 | * @return ResponseInterface JSON response of search suggestions |
38 | 37 | */ |
39 | - public function main(ServerRequestInterface $request) |
|
40 | - { |
|
38 | + public function main(ServerRequestInterface $request) { |
|
41 | 39 | $output = [ |
42 | 40 | 'documents' => [], |
43 | 41 | 'numFound' => 0 |
@@ -118,8 +116,7 @@ discard block |
||
118 | 116 | * |
119 | 117 | * @return string SOLR query |
120 | 118 | */ |
121 | - private function getQuery($fields, $parameters) |
|
122 | - { |
|
119 | + private function getQuery($fields, $parameters) { |
|
123 | 120 | return $fields['fulltext'] . ':(' . Solr::escapeQuery((string) $parameters['q']) . ') AND ' . $fields['uid'] . ':' . $this->getUid($parameters['uid']); |
124 | 121 | } |
125 | 122 | |
@@ -133,8 +130,7 @@ discard block |
||
133 | 130 | * |
134 | 131 | * @return int|string uid of the document |
135 | 132 | */ |
136 | - private function getUid($uid) |
|
137 | - { |
|
133 | + private function getUid($uid) { |
|
138 | 134 | return is_numeric($uid) ? intval($uid) : $uid; |
139 | 135 | } |
140 | 136 | } |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @subpackage dlf |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class Highlight |
|
24 | -{ |
|
23 | +class Highlight { |
|
25 | 24 | |
26 | 25 | /** |
27 | 26 | * The identifier in form 'w_h_x_y' |
@@ -80,8 +79,7 @@ discard block |
||
80 | 79 | * |
81 | 80 | * @return void |
82 | 81 | */ |
83 | - public function __construct($highlight) |
|
84 | - { |
|
82 | + public function __construct($highlight) { |
|
85 | 83 | $this->parentRegionId = $highlight['parentRegionIdx']; |
86 | 84 | $this->xBeginPosition = $highlight['ulx']; |
87 | 85 | $this->xEndPosition = $highlight['lrx']; |
@@ -97,8 +95,7 @@ discard block |
||
97 | 95 | * |
98 | 96 | * @return string The highlight's identifier |
99 | 97 | */ |
100 | - public function getId() |
|
101 | - { |
|
98 | + public function getId() { |
|
102 | 99 | return $this->id; |
103 | 100 | } |
104 | 101 | |
@@ -109,8 +106,7 @@ discard block |
||
109 | 106 | * |
110 | 107 | * @return int The highlight's horizontal beginning position |
111 | 108 | */ |
112 | - public function getXBeginPosition() |
|
113 | - { |
|
109 | + public function getXBeginPosition() { |
|
114 | 110 | return $this->xBeginPosition; |
115 | 111 | } |
116 | 112 | |
@@ -121,8 +117,7 @@ discard block |
||
121 | 117 | * |
122 | 118 | * @return int The highlight's horizontal ending position |
123 | 119 | */ |
124 | - public function getXEndPosition() |
|
125 | - { |
|
120 | + public function getXEndPosition() { |
|
126 | 121 | return $this->xEndPosition; |
127 | 122 | } |
128 | 123 | |
@@ -133,8 +128,7 @@ discard block |
||
133 | 128 | * |
134 | 129 | * @return int The highlight's vertical beginning position |
135 | 130 | */ |
136 | - public function getYBeginPosition() |
|
137 | - { |
|
131 | + public function getYBeginPosition() { |
|
138 | 132 | return $this->yBeginPosition; |
139 | 133 | } |
140 | 134 | |
@@ -145,8 +139,7 @@ discard block |
||
145 | 139 | * |
146 | 140 | * @return int The highlight's vertical ending position |
147 | 141 | */ |
148 | - public function getYEndPosition() |
|
149 | - { |
|
142 | + public function getYEndPosition() { |
|
150 | 143 | return $this->yEndPosition; |
151 | 144 | } |
152 | 145 | } |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | * @subpackage dlf |
23 | 23 | * @access public |
24 | 24 | */ |
25 | -class Alto implements \Kitodo\Dlf\Common\FulltextInterface |
|
26 | -{ |
|
25 | +class Alto implements \Kitodo\Dlf\Common\FulltextInterface { |
|
27 | 26 | /** |
28 | 27 | * This extracts the fulltext data from ALTO XML |
29 | 28 | * |
@@ -33,8 +32,7 @@ discard block |
||
33 | 32 | * |
34 | 33 | * @return string The raw unformatted fulltext |
35 | 34 | */ |
36 | - public function getRawText(\SimpleXMLElement $xml) |
|
37 | - { |
|
35 | + public function getRawText(\SimpleXMLElement $xml) { |
|
38 | 36 | $rawText = ''; |
39 | 37 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); |
40 | 38 | // Get all (presumed) words of the text. |
@@ -54,8 +52,7 @@ discard block |
||
54 | 52 | * |
55 | 53 | * @return string The unformatted fulltext in MiniOCR format |
56 | 54 | */ |
57 | - public function getTextAsMiniOcr(\SimpleXMLElement $xml) |
|
58 | - { |
|
55 | + public function getTextAsMiniOcr(\SimpleXMLElement $xml) { |
|
59 | 56 | $xml->registerXPathNamespace('alto', 'http://www.loc.gov/standards/alto/ns-v2#'); |
60 | 57 | |
61 | 58 | // get all text blocks |
@@ -99,8 +96,7 @@ discard block |
||
99 | 96 | * |
100 | 97 | * @return string The parsed word extracted from attribute |
101 | 98 | */ |
102 | - private function getWord($attributes) |
|
103 | - { |
|
99 | + private function getWord($attributes) { |
|
104 | 100 | return htmlspecialchars((string) $attributes['CONTENT']) . ' '; |
105 | 101 | } |
106 | 102 | |
@@ -113,8 +109,7 @@ discard block |
||
113 | 109 | * |
114 | 110 | * @return string The parsed word coordinates extracted from attribute |
115 | 111 | */ |
116 | - private function getCoordinates($attributes) |
|
117 | - { |
|
112 | + private function getCoordinates($attributes) { |
|
118 | 113 | return (string) $attributes['HPOS'] . ' ' . (string) $attributes['VPOS'] . ' ' . (string) $attributes['WIDTH'] . ' ' . (string) $attributes['HEIGHT']; |
119 | 114 | } |
120 | 115 | } |
@@ -34,8 +34,7 @@ discard block |
||
34 | 34 | * @subpackage dlf |
35 | 35 | * @access public |
36 | 36 | */ |
37 | -class PageViewProxy |
|
38 | -{ |
|
37 | +class PageViewProxy { |
|
39 | 38 | /** |
40 | 39 | * @var RequestFactory |
41 | 40 | */ |
@@ -46,8 +45,7 @@ discard block |
||
46 | 45 | */ |
47 | 46 | protected $extConf; |
48 | 47 | |
49 | - public function __construct() |
|
50 | - { |
|
48 | + public function __construct() { |
|
51 | 49 | $this->requestFactory = GeneralUtility::makeInstance(RequestFactory::class); |
52 | 50 | $this->extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf'); |
53 | 51 | } |
@@ -173,8 +171,7 @@ discard block |
||
173 | 171 | * @param ServerRequestInterface $request |
174 | 172 | * @return ResponseInterface |
175 | 173 | */ |
176 | - public function main(ServerRequestInterface $request) |
|
177 | - { |
|
174 | + public function main(ServerRequestInterface $request) { |
|
178 | 175 | switch ($request->getMethod()) { |
179 | 176 | case 'OPTIONS': |
180 | 177 | return $this->handleOptions($request); |
@@ -23,8 +23,7 @@ |
||
23 | 23 | { |
24 | 24 | use StreamDecoratorTrait; |
25 | 25 | |
26 | - public function emit() |
|
27 | - { |
|
26 | + public function emit() { |
|
28 | 27 | // Disable output buffering |
29 | 28 | ob_end_flush(); |
30 | 29 |
@@ -32,8 +32,7 @@ discard block |
||
32 | 32 | * @subpackage dlf |
33 | 33 | * @access public |
34 | 34 | */ |
35 | -class Generator |
|
36 | -{ |
|
35 | +class Generator { |
|
37 | 36 | /** |
38 | 37 | * @var ObjectManager |
39 | 38 | */ |
@@ -49,8 +48,7 @@ discard block |
||
49 | 48 | */ |
50 | 49 | protected $dataMapper; |
51 | 50 | |
52 | - public function __construct() |
|
53 | - { |
|
51 | + public function __construct() { |
|
54 | 52 | $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class); |
55 | 53 | $this->languageService = $this->objectManager->get(LanguageService::class); |
56 | 54 | $this->dataMapper = $this->objectManager->get(DataMapper::class); |
@@ -167,8 +165,7 @@ discard block |
||
167 | 165 | return $result; |
168 | 166 | } |
169 | 167 | |
170 | - protected function parseDocComment($docComment) |
|
171 | - { |
|
168 | + protected function parseDocComment($docComment) { |
|
172 | 169 | // TODO: Consider using phpDocumentor (though that splits the docblock into summary and description) |
173 | 170 | |
174 | 171 | // Adopted from DocCommentParser in TYPO3 v9 |
@@ -193,8 +190,7 @@ discard block |
||
193 | 190 | /** |
194 | 191 | * Transform table structure into .rst page. |
195 | 192 | */ |
196 | - public function generatePage(array $tables) |
|
197 | - { |
|
193 | + public function generatePage(array $tables) { |
|
198 | 194 | $page = new RstSection(); |
199 | 195 | $page->setHeader('Database Tables'); |
200 | 196 | $page->addText(<<<RST |
@@ -249,6 +245,4 @@ discard block |
||
249 | 245 | |
250 | 246 | $section->addTable($rows, $header); |
251 | 247 | } |
252 | - return $page; |
|
253 | - } |
|
254 | -} |
|
248 | + return $page |
|
255 | 249 | \ No newline at end of file |
@@ -20,8 +20,7 @@ discard block |
||
20 | 20 | * @subpackage dlf |
21 | 21 | * @access public |
22 | 22 | */ |
23 | -class RstSection |
|
24 | -{ |
|
23 | +class RstSection { |
|
25 | 24 | /** @var string */ |
26 | 25 | protected $header = ''; |
27 | 26 | |
@@ -31,8 +30,7 @@ discard block |
||
31 | 30 | /** @var RstSection[] */ |
32 | 31 | protected $subsections = []; |
33 | 32 | |
34 | - public static function format(string $text, array $format = []) |
|
35 | - { |
|
33 | + public static function format(string $text, array $format = []) { |
|
36 | 34 | if (!empty($text)) { |
37 | 35 | if ($format['bold'] ?? false) { |
38 | 36 | $text = '**' . $text . '**'; |
@@ -44,8 +42,7 @@ discard block |
||
44 | 42 | return $text; |
45 | 43 | } |
46 | 44 | |
47 | - public static function paragraphs(array $paragraphs) |
|
48 | - { |
|
45 | + public static function paragraphs(array $paragraphs) { |
|
49 | 46 | $paragraphs = array_values(array_filter($paragraphs, function ($entry) { |
50 | 47 | return !empty($entry); |
51 | 48 | })); |
@@ -53,27 +50,23 @@ discard block |
||
53 | 50 | return implode("\n\n", $paragraphs); |
54 | 51 | } |
55 | 52 | |
56 | - public function subsection() |
|
57 | - { |
|
53 | + public function subsection() { |
|
58 | 54 | $section = new static(); |
59 | 55 | $this->subsections[] = $section; |
60 | 56 | return $section; |
61 | 57 | } |
62 | 58 | |
63 | - public function setHeader(string $text) |
|
64 | - { |
|
59 | + public function setHeader(string $text) { |
|
65 | 60 | $this->header = $text; |
66 | 61 | } |
67 | 62 | |
68 | - public function addText(string $text) |
|
69 | - { |
|
63 | + public function addText(string $text) { |
|
70 | 64 | if (!empty($text)) { |
71 | 65 | $this->text .= $text . "\n\n"; |
72 | 66 | } |
73 | 67 | } |
74 | 68 | |
75 | - public function addTable(array $rows, array $headerRows) |
|
76 | - { |
|
69 | + public function addTable(array $rows, array $headerRows) { |
|
77 | 70 | $numHeaderRows = count($headerRows); |
78 | 71 | |
79 | 72 | $tableRst = <<<RST |
@@ -115,8 +108,7 @@ discard block |
||
115 | 108 | $this->addText($tableRst); |
116 | 109 | } |
117 | 110 | |
118 | - public function render(int $level = 0) |
|
119 | - { |
|
111 | + public function render(int $level = 0) { |
|
120 | 112 | $result = ''; |
121 | 113 | |
122 | 114 | $result .= $this->renderHeader($level); |
@@ -130,8 +122,7 @@ discard block |
||
130 | 122 | return $result; |
131 | 123 | } |
132 | 124 | |
133 | - protected function renderHeader(int $level) |
|
134 | - { |
|
125 | + protected function renderHeader(int $level) { |
|
135 | 126 | $result = ''; |
136 | 127 | |
137 | 128 | $headerChar = ['=', '=', '-', '~', '"'][$level]; |