schmiddim /
mvg-live-php
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 | -s '' -e '' -n |
||
| 5 | |||
| 6 | */ |
||
| 7 | use Mvg\Parser\Html\Departures; |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 8 | use Mvg\Parser\Html\Stations; |
||
|
0 ignored issues
–
show
|
|||
| 9 | use Mvg\TextOutput\Departures as TextOutputDepartures; |
||
| 10 | use Mvg\TextOutput\Stations as TextOutputStations; |
||
| 11 | use Mvg\Factories\Departures as DeparturesFactory; |
||
| 12 | use Mvg\RequestHandler\Html\HttpGetDepartures; |
||
| 13 | use Mvg\LedMatrixOutput\Departures as LedMatrixOutPutDepartues; |
||
| 14 | |||
| 15 | require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor/autoload.php'; |
||
| 16 | |||
| 17 | $searchForStations = array( |
||
| 18 | 'Bonner Platz', |
||
| 19 | 'Karl-Theodor-Straße', |
||
| 20 | 'Hohenzollernplatz' |
||
| 21 | ); |
||
| 22 | $filterForStations = array( |
||
| 23 | 'Fürstenried West', |
||
| 24 | 'Sendlinger Tor', |
||
| 25 | 'Einsteinstraße', |
||
| 26 | 'Messestadt Ost', |
||
| 27 | ); |
||
| 28 | #$filterForStations = []; |
||
|
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
58% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. Loading history...
|
|||
| 29 | $outputArrays = array(); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 30 | $outputArrays['lines'] = array(); |
||
| 31 | foreach ($searchForStations as $searchForStation) { |
||
| 32 | $searchForStation = trim($searchForStation); |
||
| 33 | $http = new HttpGetDepartures('http', 'www.mvg-live.de', 'ims/dfiStaticAuswahl.svc'); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 13 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 34 | $result = $http->getDeparturesForStation($searchForStation); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 35 | $parser = new Departures($result); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 11 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 36 | $departures = $parser->getDepartures(); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 37 | |||
| 38 | |||
| 39 | $factory = new DeparturesFactory($parser); |
||
| 40 | |||
| 41 | $lineArray = (new LedMatrixOutPutDepartues($factory, $filterForStations))->getOutput(); |
||
| 42 | if (null !== $lineArray) { |
||
| 43 | $outputArrays['lines'][] = $lineArray; |
||
| 44 | } |
||
| 45 | |||
| 46 | } |
||
| 47 | $outputArrays['lineCount'] = count($outputArrays['lines']); |
||
| 48 | |||
| 49 | //ArduinoJson Library has trouble with unicode |
||
| 50 | ob_start(); |
||
| 51 | echo iconv("UTF-8", "CP437",trim(json_encode($outputArrays)) ); |
||
|
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
UTF-8 does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
Coding Style
Comprehensibility
introduced
by
The string literal
CP437 does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. Loading history...
|
|||
| 52 | $content = ob_get_contents(); |
||
| 53 | $length = strlen($content); |
||
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 54 | header('Content-Length: '.$length); |
||
|
0 ignored issues
–
show
|
|||
| 55 |