Removed PHP_EOL

just replace "*/ ?>" and "<?php /*" with '' and "Trim" output whatever is EOF will trimmed out.
This commit is contained in:
Ganesh Kandu 2020-10-27 18:08:14 +05:30 committed by GitHub
parent 42a72c02fa
commit e69e3fef7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,7 +19,7 @@ public function read($filepath)
$data = file_get_contents($filepath); $data = file_get_contents($filepath);
$data = str_replace(self::getPhpHeaders(), '', $data); $data = str_replace(self::getPhpHeaders(), '', $data);
$data = str_replace(self::getPhpSuffix(), '', $data); $data = str_replace(self::getPhpSuffix(), '', $data);
$data = json_decode($data, true); $data = json_decode(trim($data), true);
if ($data === null) { if ($data === null) {
$errorCode = json_last_error(); $errorCode = json_last_error();
$error = sprintf( $error = sprintf(
@ -73,7 +73,7 @@ public function getExtension()
*/ */
public static function getPhpHeaders() public static function getPhpHeaders()
{ {
return '<?php /*'. "\n"; return '<?php /*';
} }
/** /**
@ -85,6 +85,6 @@ public static function getPhpHeaders()
*/ */
public static function getPhpSuffix() public static function getPhpSuffix()
{ {
return "\n" . '*/ ?>'; return '*/ ?>';
} }
} }