mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-11-05 21:07:57 +00:00
A simpler way to get line number
This commit is contained in:
parent
1f15a51f16
commit
36159b616c
@ -400,11 +400,7 @@ class JedcheckerRulesJamss extends JEDcheckerRule
|
|||||||
*/
|
*/
|
||||||
private function calculate_line_number($offset, $file_content)
|
private function calculate_line_number($offset, $file_content)
|
||||||
{
|
{
|
||||||
// Fetches all the text before the match
|
return substr_count($file_content, "\n", 0, $offset) + 1;
|
||||||
list($first_part) = str_split($file_content, $offset);
|
|
||||||
$line_nr = strlen($first_part) - strlen(str_replace("\n", "", $first_part)) + 1;
|
|
||||||
|
|
||||||
return $line_nr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user