Passed
Pull Request — master (#155)
by
unknown
09:48
created
Classes/Controller/AbstractSearchController.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
 use TYPO3\CMS\Core\Utility\GeneralUtility;
18 18
 use EWW\Dpf\Services\ElasticSearch;
19 19
 
20
-abstract class AbstractSearchController extends \EWW\Dpf\Controller\AbstractController
21
-{
20
+abstract class AbstractSearchController extends \EWW\Dpf\Controller\AbstractController {
22 21
     // search terms
23 22
     private static $terms   = ['_id', 'OWNER_ID', 'submitter', 'project'];
24 23
 
@@ -30,8 +29,7 @@  discard block
 block discarded – undo
30 29
      * @param  array $query elasticsearch search query
31 30
      * @return array        results
32 31
      */
33
-    public function getResultList($query, $type)
34
-    {
32
+    public function getResultList($query, $type) {
35 33
 
36 34
         $elasticSearch = $this->objectManager->get(ElasticSearch::class);
37 35
         $results = $elasticSearch->search($query, $type);
@@ -44,8 +42,7 @@  discard block
 block discarded – undo
44 42
      * @param  string $searchString
45 43
      * @return array query
46 44
      */
47
-    public function searchFulltext($searchString)
48
-    {
45
+    public function searchFulltext($searchString) {
49 46
         // don't return query if searchString is empty
50 47
         if (empty($searchString)) {
51 48
             return null;
@@ -68,8 +65,7 @@  discard block
 block discarded – undo
68 65
      * build array for elasticsearch
69 66
      * @return array Elasticsearch query array
70 67
      */
71
-    public function extendedSearch($searchArray = array())
72
-    {
68
+    public function extendedSearch($searchArray = array()) {
73 69
 
74 70
         $query  = array();
75 71
         $filter = array();
@@ -116,8 +112,7 @@  discard block
 block discarded – undo
116 112
      * @param array Elasticsearch query array
117 113
      * @return array Elasticsearch queryFilter array
118 114
      */
119
-    public function resultsFilter($query, $showDeleted = false)
120
-    {
115
+    public function resultsFilter($query, $showDeleted = false) {
121 116
 
122 117
         $queryFilter = array();
123 118
 
@@ -201,8 +196,7 @@  discard block
 block discarded – undo
201 196
      * @param  bool      $intervalEnd Fills missing values with the maximum possible date if true
202 197
      * @return DateTime               Determined date
203 198
      */
204
-    public function convertFormDate($dateString, $intervalEnd = false)
205
-    {
199
+    public function convertFormDate($dateString, $intervalEnd = false) {
206 200
         try {
207 201
             if (strlen($dateString) == 4) {
208 202
                 // assuming year
@@ -223,8 +217,7 @@  discard block
 block discarded – undo
223 217
      * @param $string
224 218
      * @return mixed
225 219
      */
226
-    private function escapeQuery($string)
227
-    {
220
+    private function escapeQuery($string) {
228 221
         $luceneReservedCharacters = preg_quote('+-&|!(){}[]^"~?:\\');
229 222
         $string                   = preg_replace_callback(
230 223
             '/([' . $luceneReservedCharacters . '])/',
@@ -242,8 +235,7 @@  discard block
 block discarded – undo
242 235
      * @param $date
243 236
      * @return string
244 237
      */
245
-    public function formatDate($date)
246
-    {
238
+    public function formatDate($date) {
247 239
         // convert date from dd.mm.yyy to yyyy-dd-mm
248 240
         $date = explode(".", $date);
249 241
         return $date[2] . '-' . $date[1] . '-' . $date[0];
Please login to merge, or discard this patch.
Classes/ViewHelpers/IsElementAllowedViewHelper.php 1 patch
Braces   +9 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,22 +20,22 @@  discard block
 block discarded – undo
20 20
 use TYPO3\CMS\Extbase\Object\ObjectManager;
21 21
 use \EWW\Dpf\Security\Security;
22 22
 
23
-class IsElementAllowedViewHelper extends AbstractViewHelper
24
-{
23
+class IsElementAllowedViewHelper extends AbstractViewHelper {
25 24
     /**
26 25
      * @param array $arguments
27 26
      * @param \Closure $renderChildrenClosure
28 27
      * @param RenderingContextInterface $renderingContext
29 28
      * @return boolean
30 29
      */
31
-    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
32
-    {
30
+    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) {
33 31
         //$pluginName = $renderingContext->getControllerContext()->getRequest()->getPluginName();
34 32
 
35 33
         $roles = array();
36 34
         if (key_exists('condition', $arguments)) {
37 35
             $roles = $arguments['condition'];
38
-            if (!is_array($roles)) return FALSE;
36
+            if (!is_array($roles)) {
37
+                return FALSE;
38
+            }
39 39
         }
40 40
 
41 41
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
@@ -50,7 +50,9 @@  discard block
 block discarded – undo
50 50
             return TRUE;
51 51
         } else {
52 52
             foreach ($roles as $role) {
53
-                if ($role === $clientUserRole) return TRUE;
53
+                if ($role === $clientUserRole) {
54
+                    return TRUE;
55
+                }
54 56
             }
55 57
         }
56 58
 
@@ -63,8 +65,7 @@  discard block
 block discarded – undo
63 65
      * @param array $condition
64 66
      *
65 67
      */
66
-    public function render($condition)
67
-    {
68
+    public function render($condition) {
68 69
         return self::renderStatic(
69 70
             array('condition' => $condition),
70 71
             $this->buildRenderChildrenClosure(),
Please login to merge, or discard this patch.
Classes/ViewHelpers/Link/DataCiteViewHelper.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
 use TYPO3\CMS\Core\Utility\MathUtility;
18 18
 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
19 19
 
20
-class DataCiteViewHelper extends AbstractViewHelper
21
-{
20
+class DataCiteViewHelper extends AbstractViewHelper {
22 21
     /**
23 22
      * @var \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder
24 23
      * @inject
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
      * @param  string $class
49 48
      * @return string html output
50 49
      */
51
-    protected function getViewIcon($row, $pageUid, $apiPid, $insideText, $class)
52
-    {
50
+    protected function getViewIcon($row, $pageUid, $apiPid, $insideText, $class) {
53 51
         $dataCite = $this->uriBuilder
54 52
             ->reset()
55 53
             ->setTargetPageUid($apiPid)
@@ -74,8 +72,7 @@  discard block
 block discarded – undo
74 72
      * @param  string $class
75 73
      * @return string the rendered record list
76 74
      */
77
-    public function render(array $arguments, $pageUid, $apiPid, $class)
78
-    {
75
+    public function render(array $arguments, $pageUid, $apiPid, $class) {
79 76
 
80 77
         if ($arguments['document']) {
81 78
 
Please login to merge, or discard this patch.
Classes/ViewHelpers/Link/PreviewViewHelper.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@  discard block
 block discarded – undo
18 18
 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
19 19
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
20 20
 
21
-class PreviewViewHelper extends AbstractViewHelper
22
-{
21
+class PreviewViewHelper extends AbstractViewHelper {
23 22
     /**
24 23
      * @var \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
25 24
      * @inject
@@ -78,8 +77,7 @@  discard block
 block discarded – undo
78 77
      * @param  string $class
79 78
      * @return string html output
80 79
      */
81
-    protected function getViewIcon(array $row, $pageUid, $apiPid, $insideText, $class)
82
-    {
80
+    protected function getViewIcon(array $row, $pageUid, $apiPid, $insideText, $class) {
83 81
 
84 82
        $previewMets = $this->uriBuilder
85 83
             ->reset()
@@ -121,8 +119,7 @@  discard block
 block discarded – undo
121 119
      * @param  string $class
122 120
      * @return string the rendered record list
123 121
      */
124
-    public function render(array $arguments, $pageUid, $apiPid, $class)
125
-    {
122
+    public function render(array $arguments, $pageUid, $apiPid, $class) {
126 123
         if ($arguments['document']) {
127 124
 
128 125
             // it's already a document object?
Please login to merge, or discard this patch.
Classes/ViewHelpers/ActiveManagerMenuViewHelper.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,16 +14,14 @@
 block discarded – undo
14 14
  * The TYPO3 project - inspiring people to share!
15 15
  */
16 16
 
17
-class ActiveManagerMenuViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
18
-{
17
+class ActiveManagerMenuViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
19 18
 
20 19
     /**
21 20
      *
22 21
      * @param string $controllerName The controller to be active.
23 22
      * @param array $actionNames The actions to be active.
24 23
      */
25
-    public function render($controllerName, $actionNames = array())
26
-    {
24
+    public function render($controllerName, $actionNames = array()) {
27 25
         if ($this->controllerContext->getRequest()->getControllerName() == $controllerName) {
28 26
 
29 27
             if (empty($actionNames)) {
Please login to merge, or discard this patch.
Classes/Helper/FormDataReader.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 use EWW\Dpf\Domain\Model\File;
18 18
 
19
-class FormDataReader
20
-{
19
+class FormDataReader {
21 20
 
22 21
     /**
23 22
      * documentTypeRepository
@@ -110,8 +109,7 @@  discard block
 block discarded – undo
110 109
      */
111 110
     protected $uploadBaseUrl;
112 111
 
113
-    public function __construct()
114
-    {
112
+    public function __construct() {
115 113
 
116 114
         $uploadFileUrl = new \EWW\Dpf\Helper\UploadFileUrl;
117 115
 
@@ -125,14 +123,12 @@  discard block
 block discarded – undo
125 123
      *
126 124
      * @param array $formData
127 125
      */
128
-    public function setFormData($formData)
129
-    {
126
+    public function setFormData($formData) {
130 127
         $this->formData     = $formData;
131 128
         $this->documentType = $this->documentTypeRepository->findByUid($formData['type']);
132 129
     }
133 130
 
134
-    protected function getFields()
135
-    {
131
+    protected function getFields() {
136 132
 
137 133
         $fields = array();
138 134
 
@@ -146,8 +142,7 @@  discard block
 block discarded – undo
146 142
         return $fields;
147 143
     }
148 144
 
149
-    protected function getDeletedFiles()
150
-    {
145
+    protected function getDeletedFiles() {
151 146
         $deletedFiles = array();
152 147
 
153 148
         if (is_array($this->formData['deleteFile'])) {
@@ -167,8 +162,7 @@  discard block
 block discarded – undo
167 162
         return $deletedFiles;
168 163
     }
169 164
 
170
-    protected function getNewAndUpdatedFiles()
171
-    {
165
+    protected function getNewAndUpdatedFiles() {
172 166
 
173 167
         $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
174 168
         $fullTextLabel          = $frameworkConfiguration['settings']['defaultValue']['fullTextLabel'];
@@ -259,8 +253,7 @@  discard block
 block discarded – undo
259 253
 
260 254
     }
261 255
 
262
-    public function uploadError()
263
-    {
256
+    public function uploadError() {
264 257
         if (
265 258
             $this->formData['primaryFile'] &&
266 259
             $this->formData['primaryFile']['error'] != 0 &&
@@ -280,8 +273,7 @@  discard block
 block discarded – undo
280 273
         return false;
281 274
     }
282 275
 
283
-    protected function getUploadedFile($tmpFile, $primary = false, \EWW\Dpf\Domain\Model\File $file = null)
284
-    {
276
+    protected function getUploadedFile($tmpFile, $primary = false, \EWW\Dpf\Domain\Model\File $file = null) {
285 277
 
286 278
         if (empty($file)) {
287 279
             $file = $this->objectManager->get(File::class);
@@ -317,8 +309,7 @@  discard block
 block discarded – undo
317 309
         return $file;
318 310
     }
319 311
 
320
-    public function getDocumentForm()
321
-    {
312
+    public function getDocumentForm() {
322 313
 
323 314
         $fields = $this->getFields();
324 315
 
Please login to merge, or discard this patch.
Classes/Helper/Slub.php 1 patch
Braces   +14 added lines, -28 removed lines patch added patch discarded remove patch
@@ -14,18 +14,15 @@  discard block
 block discarded – undo
14 14
  * The TYPO3 project - inspiring people to share!
15 15
  */
16 16
 
17
-class Slub
18
-{
17
+class Slub {
19 18
 
20 19
     protected $slubDom;
21 20
 
22
-    public function __construct($slubXml)
23
-    {
21
+    public function __construct($slubXml) {
24 22
         $this->setSlubXml($slubXml);
25 23
     }
26 24
 
27
-    public function setSlubXml($slubXml)
28
-    {
25
+    public function setSlubXml($slubXml) {
29 26
         $slubDom = new \DOMDocument();
30 27
         if (!empty($slubXml)) {
31 28
             $slubDom->loadXML($slubXml);
@@ -33,31 +30,26 @@  discard block
 block discarded – undo
33 30
         $this->slubDom = $slubDom;
34 31
     }
35 32
 
36
-    public function getSlubXml()
37
-    {
33
+    public function getSlubXml() {
38 34
         return $this->slubDom->saveXML();
39 35
     }
40 36
 
41
-    public function getSlubXpath()
42
-    {
37
+    public function getSlubXpath() {
43 38
         $xpath = \EWW\Dpf\Helper\XPath::create($this->slubDom);
44 39
         return $xpath;
45 40
     }
46 41
 
47
-    public function getDocumentType()
48
-    {
42
+    public function getDocumentType() {
49 43
         $documentTypeNode = $this->getSlubXpath()->query("/slub:info/slub:documentType");
50 44
         return $documentTypeNode->item(0)->nodeValue;
51 45
     }
52 46
 
53
-    public function getProcessNumber()
54
-    {
47
+    public function getProcessNumber() {
55 48
         $processNumberNode = $this->getSlubXpath()->query("/slub:info/slub:processNumber");
56 49
         return $processNumberNode->item(0)->nodeValue;
57 50
     }
58 51
 
59
-    public function setProcessNumber($processNumber)
60
-    {
52
+    public function setProcessNumber($processNumber) {
61 53
         $processNumberNode = $this->getSlubXpath()->query("/slub:info/slub:processNumber");
62 54
         if ($processNumberNode->length == 1) {
63 55
             $processNumberNode->item(0)->nodeValue = $processNumber;
@@ -73,40 +65,34 @@  discard block
 block discarded – undo
73 65
         }
74 66
     }
75 67
 
76
-    public function getSubmitterEmail()
77
-    {
68
+    public function getSubmitterEmail() {
78 69
         $emailNode = $this->getSlubXpath()->query("/slub:info/slub:submitter/foaf:Person/foaf:mbox");
79 70
         return $emailNode->item(0)->nodeValue;
80 71
     }
81 72
 
82
-    public function getSubmitterName()
83
-    {
73
+    public function getSubmitterName() {
84 74
         $nameNode = $this->getSlubXpath()->query("/slub:info/slub:submitter/foaf:Person/foaf:name");
85 75
         return $nameNode->item(0)->nodeValue;
86 76
     }
87 77
 
88
-    public function getSubmitterNotice()
89
-    {
78
+    public function getSubmitterNotice() {
90 79
         $nameNode = $this->getSlubXpath()->query("/slub:info/slub:submitter/slub:notice");
91 80
         return $nameNode->item(0)->nodeValue;
92 81
     }
93 82
 
94
-    public function getNotes()
95
-    {
83
+    public function getNotes() {
96 84
         $node = $this->getSlubXpath()->query("/slub:info/slub:note");
97 85
 
98 86
         $notes = array();
99 87
 
100
-        for ($i=0; $i < $node->length; $i++)
101
-        {
88
+        for ($i=0; $i < $node->length; $i++) {
102 89
             $notes[] = $node->item($i)->nodeValue;
103 90
         }
104 91
 
105 92
         return $notes;
106 93
     }
107 94
 
108
-    public function addNote($noteContent)
109
-    {
95
+    public function addNote($noteContent) {
110 96
         $slubInfoNode = $this->getSlubXpath()->query('/slub:info');
111 97
 
112 98
         if ($slubInfoNode->length == 1) {
Please login to merge, or discard this patch.
Classes/Helper/DocumentMapper.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
 use EWW\Dpf\Domain\Workflow\DocumentWorkflow;
20 20
 use EWW\Dpf\Services\ProcessNumber\ProcessNumberGenerator;
21 21
 
22
-class DocumentMapper
23
-{
22
+class DocumentMapper {
24 23
 
25 24
     /**
26 25
      * objectManager
@@ -70,8 +69,7 @@  discard block
 block discarded – undo
70 69
      */
71 70
     protected $fileRepository = null;
72 71
 
73
-    public function getDocumentForm($document)
74
-    {
72
+    public function getDocumentForm($document) {
75 73
 
76 74
         $documentForm = new \EWW\Dpf\Domain\Model\DocumentForm();
77 75
         $documentForm->setUid($document->getDocumentType()->getUid());
@@ -296,8 +294,7 @@  discard block
 block discarded – undo
296 294
         return $documentForm;
297 295
     }
298 296
 
299
-    public function getDocument($documentForm)
300
-    {
297
+    public function getDocument($documentForm) {
301 298
 
302 299
         if ($documentForm->getDocumentUid()) {
303 300
             $document = $this->documentRepository->findByUid($documentForm->getDocumentUid());
@@ -355,8 +352,7 @@  discard block
 block discarded – undo
355 352
         return $document;
356 353
     }
357 354
 
358
-    public function getMetadata($documentForm)
359
-    {
355
+    public function getMetadata($documentForm) {
360 356
 
361 357
         foreach ($documentForm->getItems() as $page) {
362 358
 
Please login to merge, or discard this patch.
Classes/Helper/Mets.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
  * The TYPO3 project - inspiring people to share!
15 15
  */
16 16
 
17
-class Mets
18
-{
17
+class Mets {
19 18
 
20 19
     /**
21 20
      * mets
@@ -24,30 +23,25 @@  discard block
 block discarded – undo
24 23
      */
25 24
     protected $metsDom;
26 25
 
27
-    public function __construct($metsXml)
28
-    {
26
+    public function __construct($metsXml) {
29 27
         $this->setMetsXml($metsXml);
30 28
     }
31 29
 
32
-    public function setMetsXml($metsXml)
33
-    {
30
+    public function setMetsXml($metsXml) {
34 31
         $metsDom = new \DOMDocument();
35 32
         $metsDom->loadXML($metsXml);
36 33
         $this->metsDom = $metsDom;
37 34
     }
38 35
 
39
-    public function getMetsXml()
40
-    {
36
+    public function getMetsXml() {
41 37
         return $this->metsDom->saveXML();
42 38
     }
43 39
 
44
-    public function getMetsXpath()
45
-    {
40
+    public function getMetsXpath() {
46 41
         return new \DOMXPath($this->metsDom);
47 42
     }
48 43
 
49
-    public function getMods()
50
-    {
44
+    public function getMods() {
51 45
         $xpath = $this->getMetsXpath();
52 46
 
53 47
         $xpath->registerNamespace("mods", "http://www.loc.gov/mods/v3");
@@ -60,8 +54,7 @@  discard block
 block discarded – undo
60 54
         return $mods;
61 55
     }
62 56
 
63
-    public function getSlub()
64
-    {
57
+    public function getSlub() {
65 58
         $xpath = $this->getMetsXpath();
66 59
 
67 60
         $xpath->registerNamespace("slub", "http://slub-dresden.de/");
@@ -74,8 +67,7 @@  discard block
 block discarded – undo
74 67
         return $slub;
75 68
     }
76 69
 
77
-    public function getState()
78
-    {
70
+    public function getState() {
79 71
 
80 72
         $xpath = $this->getMetsXpath();
81 73
         $xpath->registerNamespace("mets", "http://www.loc.gov/METS/");
@@ -84,8 +76,7 @@  discard block
 block discarded – undo
84 76
         return $dmdSec->item(0)->getAttribute("STATUS");
85 77
     }
86 78
 
87
-    public function getLastModDate()
88
-    {
79
+    public function getLastModDate() {
89 80
         $xpath = $this->getMetsXpath();
90 81
         $xpath->registerNamespace("mets", "http://www.loc.gov/METS/");
91 82
 
@@ -93,8 +84,7 @@  discard block
 block discarded – undo
93 84
         return $dmdSec->item(0)->getAttribute("LASTMODDATE");
94 85
     }
95 86
 
96
-    public function getFiles()
97
-    {
87
+    public function getFiles() {
98 88
         $xpath = $this->getMetsXpath();
99 89
 
100 90
         $xpath->registerNamespace("xlink", "http://www.w3.org/1999/xlink");
Please login to merge, or discard this patch.