app/maguttiCms/Tools/FileHelper.php
/**
     * This method is used to detect the EOL of the first line of a file.
     *
     * @param $fileName
     *
     * @return bool|string
     */
This method is used to detect the EOL of the first line of a file.
@param $fileName

@return bool|string
This method is used to detect the EOL of the first line of a file . @param $fileName @return bool|string
public static function detectFileEOL($fileName): string
    {
        if (!file_exists($fileName)) {
            return '';
        }
        $file = @fopen($fileName, 'r');
        if ($file === false)
            return '';
        $firstLine = fgets($file);
        fclose($file);
        return FileHelper::detectStringEOL($firstLine);
    }
public static function detectFileEOL ( $ fileName ) : string { if ( ! file_exists ( $ fileName ) ) { return '' ; } $ file = @ fopen ( $ fileName , 'r' ) ; if ( $ file === false ) return '' ; $ firstLine = fgets ( $ file ) ; fclose ( $ file ) ; return FileHelper :: detectStringEOL ( $ firstLine ) ; }
This method is used to detect the EOL of the first line of a file.
This method is used to detect the EOL of the first line of a file .
// If the file doesn't exists just return an empty string meaning unknown EOL. // Return unknown EOL if there was an error opening the file. // Close the file and free up resources. // Finally detect the EOL type and return it.