Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( ec350d...56237b )
by Sebastian
02:39
created

FormEngine::itemsProcFunc_collectionList()   A

Complexity

Conditions 6
Paths 6

Size

Total Lines 18
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 18
rs 9.1111
c 0
b 0
f 0
cc 6
nc 6
nop 2
1
<?php
2
namespace Kitodo\Dlf\Hooks;
3
4
/**
5
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
6
 *
7
 * This file is part of the Kitodo and TYPO3 projects.
8
 *
9
 * @license GNU General Public License version 3 or later.
10
 * For the full copyright and license information, please read the
11
 * LICENSE.txt file that was distributed with this source code.
12
 */
13
14
use Kitodo\Dlf\Common\Helper;
15
16
/**
17
 * Hooks and helper for \TYPO3\CMS\Backend\Form\FormEngine
18
 *
19
 * @author Sebastian Meyer <[email protected]>
20
 * @package TYPO3
21
 * @subpackage dlf
22
 * @access public
23
 */
24
class FormEngine {
25
    /**
26
     * Helper to display document's thumbnail for table "tx_dlf_documents"
27
     *
28
     * @access public
29
     *
30
     * @param array &$params: An array with parameters
31
     * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
0 ignored issues
show
Bug introduced by
The type TYPO3\CMS\Backend\Form\FormEngine was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
32
     *
33
     * @return string HTML <img> tag for thumbnail
34
     */
35
    public function displayThumbnail(&$params, &$pObj) {
1 ignored issue
show
Unused Code introduced by
The parameter $pObj is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

35
    public function displayThumbnail(&$params, /** @scrutinizer ignore-unused */ &$pObj) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
36
        // Simulate TCA field type "passthrough".
37
        $output = '<input type="hidden" name="'.$params['itemFormElName'].'" value="'.$params['itemFormElValue'].'" />';
38
        if (!empty($params['itemFormElValue'])) {
39
            $output .= '<img alt="" src="'.$params['itemFormElValue'].'" />';
40
        }
41
        return $output;
42
    }
43
44
    /**
45
     * Helper to get flexform's items array for plugin "tx_dlf_collection"
46
     *
47
     * @access public
48
     *
49
     * @param array &$params: An array with parameters
50
     * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
51
     *
52
     * @return void
53
     */
54
    public function itemsProcFunc_collectionList(&$params, &$pObj) {
1 ignored issue
show
Unused Code introduced by
The parameter $pObj is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

54
    public function itemsProcFunc_collectionList(&$params, /** @scrutinizer ignore-unused */ &$pObj) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
        $pages = $params['row']['pages'];
56
        if (!empty($pages)) {
57
            foreach ($pages as $page) {
58
                if ($page['uid'] > 0) {
59
                    $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
60
                        'label,uid',
61
                        'tx_dlf_collections',
62
                        'pid='.intval($page['uid'])
63
                            .' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'
64
                            .Helper::whereClause('tx_dlf_collections'),
65
                        '',
66
                        'label',
67
                        ''
68
                    );
69
                    if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
70
                        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
71
                            $params['items'][] = $resArray;
72
                        }
73
                    }
74
                }
75
            }
76
        }
77
    }
78
79
    /**
80
     * Helper to get flexform's items array for plugin "Search"
81
     *
82
     * @access public
83
     *
84
     * @param array &$params: An array with parameters
85
     * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
86
     *
87
     * @return void
88
     */
89
    public function itemsProcFunc_extendedSearchList(&$params, &$pObj) {
1 ignored issue
show
Unused Code introduced by
The parameter $pObj is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

89
    public function itemsProcFunc_extendedSearchList(&$params, /** @scrutinizer ignore-unused */ &$pObj) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
90
        $pages = $params['row']['pages'];
91
        if (!empty($pages)) {
92
            foreach ($pages as $page) {
93
                if ($page['uid'] > 0) {
94
                    $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
95
                        'label,index_name',
96
                        'tx_dlf_metadata',
97
                        'index_indexed=1'
98
                            .' AND pid='.intval($page['uid'])
99
                            .' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'
100
                            .Helper::whereClause('tx_dlf_metadata'),
101
                        '',
102
                        'sorting',
103
                        ''
104
                    );
105
                    if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
106
                        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
107
                            $params['items'][] = $resArray;
108
                        }
109
                    }
110
                }
111
            }
112
        }
113
    }
114
115
    /**
116
     * Helper to get flexform's items array for plugin "Search"
117
     *
118
     * @access public
119
     *
120
     * @param array &$params: An array with parameters
121
     * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
122
     *
123
     * @return void
124
     */
125
    public function itemsProcFunc_facetsList(&$params, &$pObj) {
1 ignored issue
show
Unused Code introduced by
The parameter $pObj is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

125
    public function itemsProcFunc_facetsList(&$params, /** @scrutinizer ignore-unused */ &$pObj) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
126
        $pages = $params['row']['pages'];
127
        if (!empty($pages)) {
128
            foreach ($pages as $page) {
129
                if ($page['uid'] > 0) {
130
                    $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
131
                        'label,index_name',
132
                        'tx_dlf_metadata',
133
                        'is_facet=1'
134
                            .' AND pid='.intval($page['uid'])
135
                            .' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'
136
                            .Helper::whereClause('tx_dlf_metadata'),
137
                        '',
138
                        'sorting',
139
                        ''
140
                    );
141
                    if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
142
                        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
143
                            $params['items'][] = $resArray;
144
                        }
145
                    }
146
                }
147
            }
148
        }
149
    }
150
151
    /**
152
     * Helper to get flexform's items array for plugin "OaiPmh"
153
     *
154
     * @access public
155
     *
156
     * @param array &$params: An array with parameters
157
     * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
158
     *
159
     * @return void
160
     */
161
    public function itemsProcFunc_libraryList(&$params, &$pObj) {
1 ignored issue
show
Unused Code introduced by
The parameter $pObj is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

161
    public function itemsProcFunc_libraryList(&$params, /** @scrutinizer ignore-unused */ &$pObj) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
162
        $pages = $params['row']['pages'];
163
        if (!empty($pages)) {
164
            foreach ($pages as $page) {
165
                if ($page['uid'] > 0) {
166
                    $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
167
                        'label,uid',
168
                        'tx_dlf_libraries',
169
                        'pid='.intval($page['uid'])
170
                            .' AND (sys_language_uid IN (-1,0) OR l18n_parent=0)'
171
                            .Helper::whereClause('tx_dlf_libraries'),
172
                        '',
173
                        'label',
174
                        ''
175
                    );
176
                    if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
177
                        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
178
                            $params['items'][] = $resArray;
179
                        }
180
                    }
181
                }
182
            }
183
        }
184
    }
185
186
    /**
187
     * Helper to get flexform's items array for plugin "Search"
188
     *
189
     * @access public
190
     *
191
     * @param array &$params: An array with parameters
192
     * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
193
     *
194
     * @return void
195
     */
196
    public function itemsProcFunc_solrList(&$params, &$pObj) {
1 ignored issue
show
Unused Code introduced by
The parameter $pObj is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

196
    public function itemsProcFunc_solrList(&$params, /** @scrutinizer ignore-unused */ &$pObj) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
197
        $pages = $params['row']['pages'];
198
        if (!empty($pages)) {
199
            foreach ($pages as $page) {
200
                if ($page['uid'] > 0) {
201
                    $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
202
                        'label,uid',
203
                        'tx_dlf_solrcores',
204
                        'pid IN ('.intval($page['uid']).',0)'
205
                            .Helper::whereClause('tx_dlf_solrcores'),
206
                        '',
207
                        'label',
208
                        ''
209
                    );
210
                    if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) {
211
                        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) {
212
                            $params['items'][] = $resArray;
213
                        }
214
                    }
215
                }
216
            }
217
        }
218
    }
219
220
    /**
221
     * Helper to get flexform's items array for plugin "Toolbox"
222
     *
223
     * @access public
224
     *
225
     * @param array &$params: An array with parameters
226
     * @param \TYPO3\CMS\Backend\Form\FormEngine &$pObj: The parent object
227
     *
228
     * @return void
229
     */
230
    public function itemsProcFunc_toolList(&$params, &$pObj) {
1 ignored issue
show
Unused Code introduced by
The parameter $pObj is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

230
    public function itemsProcFunc_toolList(&$params, /** @scrutinizer ignore-unused */ &$pObj) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
231
        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'] as $class => $label) {
232
            $params['items'][] = [$GLOBALS['LANG']->sL($label), $class];
233
        }
234
    }
235
}
236