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
Pull Request — dev-extbase-fluid (#754)
by Alexander
02:56
created

ItemsProcFunc::getFacetsList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * (c) Kitodo. Key to digital objects e.V. <[email protected]>
5
 *
6
 * This file is part of the Kitodo and TYPO3 projects.
7
 *
8
 * @license GNU General Public License version 3 or later.
9
 * For the full copyright and license information, please read the
10
 * LICENSE.txt file that was distributed with this source code.
11
 */
12
13
namespace Kitodo\Dlf\Hooks;
14
15
use Kitodo\Dlf\Common\Helper;
16
use TYPO3\CMS\Core\Database\ConnectionPool;
17
use TYPO3\CMS\Core\Utility\GeneralUtility;
18
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
19
use TYPO3\CMS\Extbase\Object\ObjectManager;
20
21
use TYPO3\CMS\Backend\View\PageLayoutContext;
0 ignored issues
show
Bug introduced by
The type TYPO3\CMS\Backend\View\PageLayoutContext 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...
22
23
/**
24
 * Helper for Flexform's custom "itemsProcFunc"
25
 *
26
 * @author Sebastian Meyer <[email protected]>
27
 * @package TYPO3
28
 * @subpackage dlf
29
 * @access public
30
 */
31
class ItemsProcFunc
32
{
33
    /**
34
     * @var int
35
     */
36
    protected $storagePid;
37
38
    /**
39
     * Helper to get flexform's items array for plugin "Toolbox"
40
     *
41
     * @access public
42
     *
43
     * @param array &$params: An array with parameters
44
     *
45
     * @return void
46
     */
47
    public function toolList(&$params)
48
    {
49
        foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['dlf/Classes/Plugin/Toolbox.php']['tools'] as $class => $label) {
50
            $params['items'][] = [Helper::getLanguageService()->getLL($label), $class];
51
        }
52
    }
53
54
    /**
55
     * The constructor to access TypoScript configuration
56
     *
57
     * @access public
58
     *
59
     * @return void
60
     */
61
    public function __construct()
62
    {
63
        $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
64
        $configurationManager = $objectManager->get(ConfigurationManager::class);
65
        // we must get the storagePid from full TypoScript setup at this point.
66
        $fullTyposcriptSetup = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
67
        $this->storagePid = $fullTyposcriptSetup["plugin."]["tx_dlf."]["persistence."]["storagePid"];
68
    }
69
70
    /**
71
     * Helper to get flexform's items array for plugin "Search"
72
     *
73
     * @access public
74
     *
75
     * @param array &$params: An array with parameters
76
     */
77
    public function getFacetsList(array &$params): void
78
    {
79
        $this->generateList(
80
            $params,
81
            'label,index_name',
82
            'tx_dlf_metadata',
83
            'sorting',
84
            'is_facet=1'
85
        );
86
    }
87
88
    /**
89
     * Get list items from database
90
     *
91
     * @access protected
92
     *
93
     * @param array &$params: An array with parameters
94
     * @param string $fields: Comma-separated list of fields to fetch
95
     * @param string $table: Table name to fetch the items from
96
     * @param string $sorting: Field to sort items by (optionally appended by 'ASC' or 'DESC')
97
     * @param string $andWhere: Additional AND WHERE clause
98
     *
99
     * @return void
100
     */
101
    protected function generateList(&$params, $fields, $table, $sorting, $andWhere = '')
102
    {
103
        $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
104
            ->getQueryBuilderForTable($table);
105
106
        // Get $fields from $table on given pid.
107
        $result = $queryBuilder
108
            ->select(...explode(',', $fields))
109
            ->from($table)
110
            ->where(
111
                $queryBuilder->expr()->eq($table . '.pid', intval($this->storagePid)),
112
                $queryBuilder->expr()->in($table . '.sys_language_uid', [-1, 0]),
113
                $andWhere
114
            )
115
            ->orderBy($sorting)
116
            ->execute();
117
118
        while ($resArray = $result->fetch(\PDO::FETCH_NUM)) {
119
            if ($resArray) {
120
                $params['items'][] = $resArray;
121
            }
122
        }
123
    }
124
}
125