Passed
Pull Request — master (#123)
by Sebastian
04:20 queued 32s
created
Classes/Controller/TableOfContentsController.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
24 24
  * @subpackage dlf
25 25
  * @access public
26 26
  */
27
-class TableOfContentsController extends AbstractController
28
-{
27
+class TableOfContentsController extends AbstractController {
29 28
     /**
30 29
      * This holds the active entries according to the currently selected page
31 30
      *
@@ -45,8 +44,7 @@  discard block
 block discarded – undo
45 44
      *
46 45
      * @return void
47 46
      */
48
-    public function filterAction()
49
-    {
47
+    public function filterAction() {
50 48
         // if filter was triggered, get filter parameters from POST variables
51 49
         $this->filterParams = $this->getParametersSafely('filterParameter');
52 50
 
@@ -59,8 +57,7 @@  discard block
 block discarded – undo
59 57
      *
60 58
      * @return void
61 59
      */
62
-    public function mainAction()
63
-    {
60
+    public function mainAction() {
64 61
         // Load current document.
65 62
         $this->loadDocument($this->requestData);
66 63
         if (
@@ -91,8 +88,7 @@  discard block
 block discarded – undo
91 88
      * @access protected
92 89
      * @return array HMENU array
93 90
      */
94
-    protected function makeMenuArray()
95
-    {
91
+    protected function makeMenuArray() {
96 92
         // Set default values for page if not set.
97 93
         // $this->requestData['page'] may be integer or string (physical structure @ID)
98 94
         if (
@@ -168,8 +164,7 @@  discard block
 block discarded – undo
168 164
      *
169 165
      * @return array HMENU array
170 166
      */
171
-    protected function makeMenuFor3DObjects()
172
-    {
167
+    protected function makeMenuFor3DObjects() {
173 168
         $menuArray = [];
174 169
 
175 170
         // Go through table of contents and create all menu entries.
@@ -192,8 +187,7 @@  discard block
 block discarded – undo
192 187
      *
193 188
      * @return array HMENU array for menu entry
194 189
      */
195
-    protected function getMenuEntry(array $entry, $recursive = false)
196
-    {
190
+    protected function getMenuEntry(array $entry, $recursive = false) {
197 191
         $entry = $this->resolveMenuEntry($entry);
198 192
 
199 193
         $entryArray = [];
@@ -287,8 +281,7 @@  discard block
 block discarded – undo
287 281
      * @param array $entry
288 282
      * @return array
289 283
      */
290
-    protected function resolveMenuEntry($entry)
291
-    {
284
+    protected function resolveMenuEntry($entry) {
292 285
         // If the menu entry points to the parent document,
293 286
         // resolve to the parent UID set on indexation.
294 287
         $doc = $this->document->getDoc();
@@ -304,8 +297,7 @@  discard block
 block discarded – undo
304 297
         return $entry;
305 298
     }
306 299
 
307
-    protected function getMenuEntryWithImage(array $entry, $recursive = false)
308
-    {
300
+    protected function getMenuEntryWithImage(array $entry, $recursive = false) {
309 301
         $entryArray = [];
310 302
 
311 303
         // don't filter if the entry type is collection or search params are empty
Please login to merge, or discard this patch.
Classes/Controller/BasketController.php 1 patch
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
  * @subpackage dlf
32 32
  * @access public
33 33
  */
34
-class BasketController extends AbstractController
35
-{
34
+class BasketController extends AbstractController {
36 35
     /**
37 36
      * @var BasketRepository
38 37
      */
@@ -41,8 +40,7 @@  discard block
 block discarded – undo
41 40
     /**
42 41
      * @param BasketRepository $basketRepository
43 42
      */
44
-    public function injectBasketRepository(BasketRepository $basketRepository)
45
-    {
43
+    public function injectBasketRepository(BasketRepository $basketRepository) {
46 44
         $this->basketRepository = $basketRepository;
47 45
     }
48 46
 
@@ -54,8 +52,7 @@  discard block
 block discarded – undo
54 52
     /**
55 53
      * @param MailRepository $mailRepository
56 54
      */
57
-    public function injectMailRepository(MailRepository $mailRepository)
58
-    {
55
+    public function injectMailRepository(MailRepository $mailRepository) {
59 56
         $this->mailRepository = $mailRepository;
60 57
     }
61 58
 
@@ -67,8 +64,7 @@  discard block
 block discarded – undo
67 64
     /**
68 65
      * @param PrinterRepository $printerRepository
69 66
      */
70
-    public function injectPrinterRepository(PrinterRepository $printerRepository)
71
-    {
67
+    public function injectPrinterRepository(PrinterRepository $printerRepository) {
72 68
         $this->printerRepository = $printerRepository;
73 69
     }
74 70
 
@@ -80,8 +76,7 @@  discard block
 block discarded – undo
80 76
     /**
81 77
      * @param ActionLogRepository $actionLogRepository
82 78
      */
83
-    public function injectActionLogRepository(ActionLogRepository $actionLogRepository)
84
-    {
79
+    public function injectActionLogRepository(ActionLogRepository $actionLogRepository) {
85 80
         $this->actionLogRepository = $actionLogRepository;
86 81
     }
87 82
 
@@ -90,8 +85,7 @@  discard block
 block discarded – undo
90 85
      *
91 86
      * @return void
92 87
      */
93
-    public function basketAction()
94
-    {
88
+    public function basketAction() {
95 89
         $basket = $this->getBasketData();
96 90
 
97 91
         // action remove from basket
@@ -137,8 +131,7 @@  discard block
 block discarded – undo
137 131
      *
138 132
      * @return void
139 133
      */
140
-    public function addAction()
141
-    {
134
+    public function addAction() {
142 135
         $basket = $this->getBasketData();
143 136
 
144 137
         if (
@@ -156,8 +149,7 @@  discard block
 block discarded – undo
156 149
      *
157 150
      * @return void
158 151
      */
159
-    public function mainAction()
160
-    {
152
+    public function mainAction() {
161 153
         $basket = $this->getBasketData();
162 154
 
163 155
         $countDocs = 0;
@@ -203,8 +195,7 @@  discard block
 block discarded – undo
203 195
      *
204 196
      * @return Basket The found data from user session.
205 197
      */
206
-    protected function getBasketData()
207
-    {
198
+    protected function getBasketData() {
208 199
         // get user session
209 200
         $sessionId = $GLOBALS['TSFE']->fe_user->id;
210 201
 
@@ -238,8 +229,7 @@  discard block
 block discarded – undo
238 229
      *
239 230
      * @return string One basket entry
240 231
      */
241
-    protected function getEntry($data)
242
-    {
232
+    protected function getEntry($data) {
243 233
         if (is_object($data)) {
244 234
             $data = get_object_vars($data);
245 235
         }
@@ -291,8 +281,7 @@  discard block
 block discarded – undo
291 281
      *
292 282
      * @return mixed download url or false
293 283
      */
294
-    protected function getDocumentData($id, $data)
295
-    {
284
+    protected function getDocumentData($id, $data) {
296 285
         // get document instance to load further information
297 286
         $this->loadDocument(['id' => $id]);
298 287
         if ($this->document) {
@@ -360,8 +349,7 @@  discard block
 block discarded – undo
360 349
      *
361 350
      * @return array Basket data and JavaScript output
362 351
      */
363
-    protected function addToBasket($_piVars, $basket)
364
-    {
352
+    protected function addToBasket($_piVars, $basket) {
365 353
         $output = '';
366 354
 
367 355
         if (!$_piVars['startpage']) {
@@ -468,8 +456,7 @@  discard block
 block discarded – undo
468 456
      *
469 457
      * @return Basket basket
470 458
      */
471
-    protected function removeFromBasket($_piVars, $basket)
472
-    {
459
+    protected function removeFromBasket($_piVars, $basket) {
473 460
         if (!empty($basket->getDocIds())) {
474 461
             $items = json_decode($basket->getDocIds());
475 462
             $items = get_object_vars($items);
@@ -507,8 +494,7 @@  discard block
 block discarded – undo
507 494
      *
508 495
      * @return void
509 496
      */
510
-    protected function sendMail()
511
-    {
497
+    protected function sendMail() {
512 498
         // send mail
513 499
         $mailId = $this->requestData['mail_action'];
514 500
 
@@ -585,8 +571,7 @@  discard block
 block discarded – undo
585 571
      *
586 572
      * @return void
587 573
      */
588
-    protected function printDocument($basket)
589
-    {
574
+    protected function printDocument($basket) {
590 575
         $pdfUrl = $this->settings['pdfprint'];
591 576
         $numberOfPages = 0;
592 577
         foreach ($this->requestData['selected'] as $docId => $docValue) {
Please login to merge, or discard this patch.
Classes/Format/Mods.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@
 block discarded – undo
46 46
      *
47 47
      * @return void
48 48
      */
49
-    public function extractMetadata(\SimpleXMLElement $xml, array &$metadata)
50
-    {
49
+    public function extractMetadata(\SimpleXMLElement $xml, array &$metadata) {
51 50
         $this->xml = $xml;
52 51
         $this->metadata = $metadata;
53 52
 
Please login to merge, or discard this patch.
Classes/Controller/NavigationController.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@  discard block
 block discarded – undo
23 23
  * @subpackage dlf
24 24
  * @access public
25 25
  */
26
-class NavigationController extends AbstractController
27
-{
26
+class NavigationController extends AbstractController {
28 27
     /**
29 28
      * Method to get the page select values and use them with chash
30 29
      * @param \Kitodo\Dlf\Domain\Model\PageSelectForm|NULL $pageSelectForm
@@ -53,8 +52,7 @@  discard block
 block discarded – undo
53 52
      *
54 53
      * @return void
55 54
      */
56
-    public function mainAction()
57
-    {
55
+    public function mainAction() {
58 56
         // Load current document.
59 57
         $this->loadDocument($this->requestData);
60 58
         if (
Please login to merge, or discard this patch.
Classes/Common/Indexer.php 1 patch
Braces   +9 added lines, -17 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
  * @subpackage dlf
33 33
  * @access public
34 34
  */
35
-class Indexer
36
-{
35
+class Indexer {
37 36
     /**
38 37
      * The extension key
39 38
      *
@@ -93,8 +92,7 @@  discard block
 block discarded – undo
93 92
      *
94 93
      * @return bool true on success or false on failure
95 94
      */
96
-    public static function add(Document $document)
97
-    {
95
+    public static function add(Document $document) {
98 96
         if (in_array($document->getUid(), self::$processedDocs)) {
99 97
             return true;
100 98
         } elseif (self::solrConnect($document->getSolrcore(), $document->getPid())) {
@@ -209,8 +207,7 @@  discard block
 block discarded – undo
209 207
      *
210 208
      * @return string The field's dynamic index name
211 209
      */
212
-    public static function getIndexFieldName($index_name, $pid = 0)
213
-    {
210
+    public static function getIndexFieldName($index_name, $pid = 0) {
214 211
         // Sanitize input.
215 212
         $pid = max(intval($pid), 0);
216 213
         if (!$pid) {
@@ -236,8 +233,7 @@  discard block
 block discarded – undo
236 233
      *
237 234
      * @return void
238 235
      */
239
-    protected static function loadIndexConf($pid)
240
-    {
236
+    protected static function loadIndexConf($pid) {
241 237
         if (!self::$fieldsLoaded) {
242 238
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
243 239
                 ->getQueryBuilderForTable('tx_dlf_metadata');
@@ -307,8 +303,7 @@  discard block
 block discarded – undo
307 303
      *
308 304
      * @return bool true on success or false on failure
309 305
      */
310
-    protected static function processLogical(Document $document, array $logicalUnit)
311
-    {
306
+    protected static function processLogical(Document $document, array $logicalUnit) {
312 307
         $success = true;
313 308
         $doc = $document->getDoc();
314 309
         $doc->cPid = $document->getPid();
@@ -346,7 +341,7 @@  discard block
 block discarded – undo
346 341
                 ) {
347 342
                     $solrDoc->setField('date', $metadata['date'][0]);
348 343
                 // change date YYYYMMDD to YYYY-MM-DD
349
-                } elseif (preg_match("/^[\d]{8}$/", $metadata['date'][0])){
344
+                } elseif (preg_match("/^[\d]{8}$/", $metadata['date'][0])) {
350 345
                     $solrDoc->setField('date', date("Y-m-d", strtotime($metadata['date'][0])));
351 346
                 // convert any datetime to proper ISO extended datetime format and timezone for SOLR
352 347
                 } else {
@@ -439,8 +434,7 @@  discard block
 block discarded – undo
439 434
      *
440 435
      * @return bool true on success or false on failure
441 436
      */
442
-    protected static function processPhysical(Document $document, $page, array $physicalUnit)
443
-    {
437
+    protected static function processPhysical(Document $document, $page, array $physicalUnit) {
444 438
         $doc = $document->getDoc();
445 439
         $doc->cPid = $document->getPid();
446 440
         if ($doc->hasFulltext && $fullText = $doc->getFullText($physicalUnit['id'])) {
@@ -518,8 +512,7 @@  discard block
 block discarded – undo
518 512
      *
519 513
      * @return bool true on success or false on failure
520 514
      */
521
-    protected static function solrConnect($core, $pid = 0)
522
-    {
515
+    protected static function solrConnect($core, $pid = 0) {
523 516
         // Get Solr instance.
524 517
         if (!self::$solr) {
525 518
             // Connect to Solr server.
@@ -588,8 +581,7 @@  discard block
 block discarded – undo
588 581
      *
589 582
      * @access private
590 583
      */
591
-    private function __construct()
592
-    {
584
+    private function __construct() {
593 585
         // This is a static class, thus no instances should be created.
594 586
     }
595 587
 }
Please login to merge, or discard this patch.
Classes/Api/Viaf/Client.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  **/
28
-class Client
29
-{
28
+class Client {
30 29
     /**
31 30
      * This holds the logger
32 31
      *
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
      * @param RequestFactory $requestFactory a request object to inject
64 63
      * @return void
65 64
      **/
66
-    public function __construct($viaf, RequestFactory $requestFactory)
67
-    {
65
+    public function __construct($viaf, RequestFactory $requestFactory) {
68 66
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
69 67
         $this->viafUrl = 'http://viaf.org/viaf/' . $viaf;
70 68
         $this->requestFactory = $requestFactory;
@@ -86,8 +84,7 @@  discard block
 block discarded – undo
86 84
      *
87 85
      * @return object|bool
88 86
      **/
89
-    public function getData()
90
-    {
87
+    public function getData() {
91 88
         $url = $this->getApiEndpoint();
92 89
         try {
93 90
             $response = $this->requestFactory->request($url);
@@ -103,8 +100,7 @@  discard block
 block discarded – undo
103 100
      *
104 101
      * @return string
105 102
      **/
106
-    protected function getApiEndpoint()
107
-    {
103
+    protected function getApiEndpoint() {
108 104
         return $this->viafUrl . '/' . $this->endpoint;
109 105
     }
110 106
 }
Please login to merge, or discard this patch.
Classes/Api/Orcid/Profile.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  **/
28
-class Profile
29
-{
28
+class Profile {
30 29
     /**
31 30
      * This holds the logger
32 31
      *
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
      *
58 57
      * @return void
59 58
      **/
60
-    public function __construct($orcid)
61
-    {
59
+    public function __construct($orcid) {
62 60
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
63 61
         $this->client = new Client($orcid, GeneralUtility::makeInstance(RequestFactory::class));
64 62
     }
@@ -68,8 +66,7 @@  discard block
 block discarded – undo
68 66
      *
69 67
      * @return array|false
70 68
      **/
71
-    public function getData()
72
-    {
69
+    public function getData() {
73 70
         $this->getRaw('person');
74 71
         if (!empty($this->raw)) {
75 72
             $data = [];
@@ -88,8 +85,7 @@  discard block
 block discarded – undo
88 85
      *
89 86
      * @return string|false
90 87
      **/
91
-    public function getAddress()
92
-    {
88
+    public function getAddress() {
93 89
         $this->getRaw('address');
94 90
         if (!empty($this->raw)) {
95 91
             $this->raw->registerXPathNamespace('address', 'http://www.orcid.org/ns/address');
@@ -105,8 +101,7 @@  discard block
 block discarded – undo
105 101
      *
106 102
      * @return string|false
107 103
      **/
108
-    public function getEmail()
109
-    {
104
+    public function getEmail() {
110 105
         $this->getRaw('email');
111 106
         if (!empty($this->raw)) {
112 107
             $this->raw->registerXPathNamespace('email', 'http://www.orcid.org/ns/email');
@@ -122,8 +117,7 @@  discard block
 block discarded – undo
122 117
      *
123 118
      * @return string|false
124 119
      **/
125
-    public function getFullName()
126
-    {
120
+    public function getFullName() {
127 121
         $this->getRaw('personal-details');
128 122
         if (!empty($this->raw)) {
129 123
             $this->raw->registerXPathNamespace('personal-details', 'http://www.orcid.org/ns/personal-details');
@@ -143,8 +137,7 @@  discard block
 block discarded – undo
143 137
      *
144 138
      * @return void
145 139
      **/
146
-    protected function getRaw($endpoint)
147
-    {
140
+    protected function getRaw($endpoint) {
148 141
         $this->client->setEndpoint($endpoint);
149 142
         $data = $this->client->getData();
150 143
         if (!isset($this->raw) && $data != false) {
Please login to merge, or discard this patch.
Classes/Api/Orcid/Client.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  **/
28
-class Client
29
-{
28
+class Client {
30 29
     /**
31 30
      * constants for API endpoint
32 31
      **/
@@ -76,8 +75,7 @@  discard block
 block discarded – undo
76 75
      * @param RequestFactory $requestFactory a request object to inject
77 76
      * @return void
78 77
      **/
79
-    public function __construct($orcid, RequestFactory $requestFactory)
80
-    {
78
+    public function __construct($orcid, RequestFactory $requestFactory) {
81 79
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
82 80
         $this->orcid = $orcid;
83 81
         $this->requestFactory = $requestFactory;
@@ -99,8 +97,7 @@  discard block
 block discarded – undo
99 97
      *
100 98
      * @return object|bool
101 99
      **/
102
-    public function getData()
103
-    {
100
+    public function getData() {
104 101
         $url = $this->getApiEndpoint();
105 102
         try {
106 103
             $response = $this->requestFactory->request($url);
@@ -116,8 +113,7 @@  discard block
 block discarded – undo
116 113
      *
117 114
      * @return string
118 115
      **/
119
-    private function getApiEndpoint()
120
-    {
116
+    private function getApiEndpoint() {
121 117
         $url  = 'https://' . $this->level . '.' . self::HOSTNAME;
122 118
         $url .= '/v' . self::VERSION . '/';
123 119
         $url .= $this->orcid;
Please login to merge, or discard this patch.
Classes/Api/Viaf/Profile.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,8 +25,7 @@  discard block
 block discarded – undo
25 25
  * @subpackage dlf
26 26
  * @access public
27 27
  **/
28
-class Profile
29
-{
28
+class Profile {
30 29
     /**
31 30
      * This holds the logger
32 31
      *
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
      *
58 57
      * @return void
59 58
      **/
60
-    public function __construct($viaf)
61
-    {
59
+    public function __construct($viaf) {
62 60
         $this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
63 61
         $this->client = new Client($viaf, GeneralUtility::makeInstance(RequestFactory::class));
64 62
     }
@@ -68,8 +66,7 @@  discard block
 block discarded – undo
68 66
      *
69 67
      * @return array|false
70 68
      **/
71
-    public function getData()
72
-    {
69
+    public function getData() {
73 70
         $this->getRaw();
74 71
         if (!empty($this->raw)) {
75 72
             $data = [];
@@ -87,8 +84,7 @@  discard block
 block discarded – undo
87 84
      *
88 85
      * @return string|false
89 86
      **/
90
-    public function getAddress()
91
-    {
87
+    public function getAddress() {
92 88
         $this->getRaw();
93 89
         if (!empty($this->raw->asXML())) {
94 90
             return (string) $this->raw->xpath('./ns1:nationalityOfEntity/ns1:data/ns1:text')[0];
@@ -103,8 +99,7 @@  discard block
 block discarded – undo
103 99
      *
104 100
      * @return string|false
105 101
      **/
106
-    public function getFullName()
107
-    {
102
+    public function getFullName() {
108 103
         $this->getRaw();
109 104
         if (!empty($this->raw->asXML())) {
110 105
             $rawName = $this->raw->xpath('./ns1:mainHeadings/ns1:data/ns1:text');
@@ -122,8 +117,7 @@  discard block
 block discarded – undo
122 117
      *
123 118
      * @return void
124 119
      **/
125
-    protected function getRaw()
126
-    {
120
+    protected function getRaw() {
127 121
         $data = $this->client->getData();
128 122
         if (!isset($this->raw) && $data != false) {
129 123
             $this->raw = Helper::getXmlFileAsString($data);
Please login to merge, or discard this patch.