Skip to content

Commit

Permalink
Added check: Uneven number of opening and closing quotation marks
Browse files Browse the repository at this point in the history
Change-Id: I7491d9e112d6478e3eb47556fffb52a9fcbd9e27
  • Loading branch information
Wolf Rost committed Mar 22, 2017
1 parent 2658818 commit 72172e1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions coding_standards/THMJoomla/Sniffs/PHP/ValidLanguageSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,22 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
// Auf Doppeleintrag prüfen
$ini_content = file_get_contents($filepath);
$ini_content = str_replace(" ", "", $ini_content);

// Check for forgotten opening and closing quotation marks
$ini_content_splitted = explode("\n", $ini_content);
foreach($ini_content_splitted as $key=>$splittedLine)
{
if(strpos($splittedLine, '="') !== false)
{
if(substr($splittedLine, -1) != '"')
{
// Fehlerbehandlung
$error = "Uneven number of opening and closing quotation marks in file " .$files4[$z] . "line " . ($key + 1);
$phpcsFile->addError($error, $stackPtr - 4, 'UnevenQuotationMarks', $errorData);
}
}
}

// Parsen der .ini File
$ini_array = parse_ini_file($filepath);

Expand Down

0 comments on commit 72172e1

Please sign in to comment.