protected function analyseMercure($file, string $filename, string $appname):int
    {
        $start = 0;
        $end = 0;
        while ($listen = trim(fgets($file, 1024))) {
            if ($listen == "route:" || $listen == "route :") {
                $start++;
            }
            if ($listen == "endroute") {
                $end++;
            }
        }
        if ($start != $end) {
            if ($start < $end) {
                throw new Server500(new \ArrayObject(array("explain" => "Missing tag 'route' in "
                    .$filename. " Routing file : ".$appname , "solution" => "Please check your Mercure file")));
            }
            if ($end < $start) {
                throw new Server500(new \ArrayObject(array("explain" => "Missing tag 'endroute' in "
                    .$filename. " Routing file : ".$appname, "solution" => "Please check your Mercure file")));
            }
            return (0);
        }
        return (1);
    }
protected function analyseMercure($file, string $filename, string $appname):int
    {
        $start = 0;
        $end = 0;
        while ($listen = trim(fgets($file, 1024))) {
            if ($listen == "route:" || $listen == "route :") {
                $start++;
            }
            if ($listen == "endroute") {
                $end++;
            }
        }
        if ($start != $end) {
            if ($start < $end) {
                throw new Server500(new \ArrayObject(array("explain" => "Missing tag 'route' in "
                    .$filename. " Routing file : ".$appname , "solution" => "Please check your Mercure file")));
            }
            if ($end < $start) {
                throw new Server500(new \ArrayObject(array("explain" => "Missing tag 'endroute' in "
                    .$filename. " Routing file : ".$appname, "solution" => "Please check your Mercure file")));
            }
            return (0);
        }
        return (1);
    }
protected function analyseMercure ( $ file , string $ filename , string $ appname ) : int { $ start = 0 ; $ end = 0 ; while ( $ listen = trim ( fgets ( $ file , 1024 ) ) ) { if ( $ listen == "route:" || $ listen == "route :" ) { $ start ++ ; } if ( $ listen == "endroute" ) { $ end ++ ; } } if ( $ start != $ end ) { if ( $ start < $ end ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Missing tag 'route' in " . $ filename . " Routing file : " . $ appname , "solution" => "Please check your Mercure file" ) ) ) ; } if ( $ end < $ start ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Missing tag 'endroute' in " . $ filename . " Routing file : " . $ appname , "solution" => "Please check your Mercure file" ) ) ) ; } return ( 0 ) ; } return ( 1 ) ; }
Analyse Mercure file to detect some errors
@param resource $file File resource
@param string $filename File name
@param string $appname App name
@return int If file have no error
@throws Server500 If file resource have some errors
Analyse Mercure file to detect some errors