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.

Issues (56)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Phase/TakeATicket/SongLoader.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Created by PhpStorm.
5
 * User: wechsler
6
 * Date: 21/08/15
7
 * Time: 06:53
8
 */
9
10
namespace Phase\TakeATicket;
11
12
use Doctrine\DBAL\Connection;
13
use Iterator;
14
use Phase\TakeATicket\DataSource\Factory;
15
use Phase\TakeATicket\SongLoader\RclKaraokeRowMapper;
16
use Phase\TakeATicket\SongLoader\RclRockBandRowMapper;
17
use Phase\TakeATicket\SongLoader\RowMapperInterface;
18
19
class SongLoader
20
{
21
    const CODE_LENGTH = 6; // min to avoid clashes
22
23
    protected $startRow = 2;
24
25
    /**
26
     * @var bool
27
     */
28
    protected $showProgress = false;
29
30
    /**
31
     * Class to instantiate as RowMapper
32
     *
33
     * Must implement RowMapperInterface
34
     *
35
     * @var string
36
     */
37
    protected $rowMapperClass = RclRockBandRowMapper::class;
38
39
    /**
40
     * Store contents of specified XLS file to the given database handle
41
     *
42
     * @param  string $sourceFile Path to file
43
     * @param  Connection $dbConn DB connection
44
     * @return int Number of non-duplicate songs stored
45
     * @throws \PHPExcel_Exception
46
     * @throws \PHPExcel_Reader_Exception
47
     * @throws \Doctrine\DBAL\DBALException
48
     */
49
    public function run($sourceFile, Connection $dbConn)
50
    {
51
52
        $objPHPExcel = \PHPExcel_IOFactory::load($sourceFile);
53
        $dataStore = Factory::datasourceFromDbConnection($dbConn);
54
        // empty table - reset autoincrement if it has one
55
        $dataStore->resetCatalogue(); //FIXME clear tickets here too?
56
        $mapper = $this->getRowMapper($dataStore);
57
        $mapper->init();
58
59
        $iterator = $objPHPExcel->getSheet()->getRowIterator($this->startRow);
60
61
        $i = 1;
62
        foreach ($iterator as $sourceRow) {
63
            $flattenedRow = [];
64
            /**
65
             * @var \PHPExcel_Worksheet_Row $sourceRow
66
             */
67
            $cells = $sourceRow->getCellIterator();
68
            /**
69
             * @var Iterator $cells
70
             */
71
            foreach ($cells as $cell) {
72
                /**
73
                 * @var \PHPExcel_Cell $cell
74
                 */
75
                $column = $cell->getColumn();
76
                $content = $cell->getFormattedValue();
77
78
                $flattenedRow[$column] = trim($content);
79
            }
80
81
            if (implode($flattenedRow, '') !== '') {
82
                $storedOk = $mapper->storeRawRow($flattenedRow);
83
                if ($storedOk) {
84
                    $this->printProgressMarker($i);
85
                } else {
86
                    print('x');
87
                }
88
                $i++;
89
            }
90
        }
91
92
        $total = $i - 1;
93
        if ($this->showProgress) {
94
            echo "\nImported $total songs\n";
95
        }
96
        return $total;
97
    }
98
99
    /**
100
     * @param bool $showProgress
101
     * @return SongLoader
102
     */
103
    public function setShowProgress($showProgress)
104
    {
105
        $this->showProgress = $showProgress;
106
        return $this;
107
    }
108
109
    /**
110
     * @return string
111
     */
112
    public function getRowMapperClass()
113
    {
114
        return $this->rowMapperClass;
115
    }
116
117
    /**
118
     * Set RowMapper class to use
119
     *
120
     * @param string $rowMapperClass
121
     * @return SongLoader
122
     * @throws \InvalidArgumentException If classname not valid
123
     */
124 View Code Duplication
    public function setRowMapperClass($rowMapperClass)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
125
    {
126
        $class = new \ReflectionClass($rowMapperClass);
127
        if ($class->isSubclassOf(RowMapperInterface::class)) {
128
            $this->rowMapperClass = $rowMapperClass;
129
        } else {
130
            throw new \InvalidArgumentException(
131
                "$rowMapperClass must implement " . RowMapperInterface::class
132
            );
133
        }
134
        return $this;
135
    }
136
137
    /**
138
     * @param $i
139
     */
140
    protected function printProgressMarker($i)
141
    {
142
        if ($this->showProgress) {
143
            if (!($i % 100)) {
144
                echo $i;
145
            } else {
146
                if (!($i % 10)) {
147
                    echo '.';
148
                }
149
            }
150
            if (!($i % 1000)) {
151
                echo "\n";
152
            }
153
        }
154
    }
155
156
    /**
157
     * Get the currently configured RowMapper
158
     *
159
     * @param $dataStore
160
     * @return RowMapperInterface
161
     */
162
    protected function getRowMapper($dataStore)
163
    {
164
        $rowMapperClass = $this->getRowMapperClass();
165
        return new $rowMapperClass($dataStore);
166
    }
167
}
168