public static function open(string $filepath):\stdClass
    {
        if ($filepath == self::$filepath && self::$file != null) {
            return (self::$file);
        }

        if (!file_exists($filepath)) {
            throw new Server500(new \ArrayObject(array("explain" => "Cannot open file $filepath : File does not exist",
                "solution" => "Please set the correct filepath")));
        }

        if (!is_readable($filepath)) {
            throw new Server500(new \ArrayObject(array("explain" => "Cannot open file $filepath : File not readable",
                "solution" => "Please set the correct permission")));
        }

        $a = json_decode(file_get_contents($filepath));

        self::$file = ($a == null ? new \stdClass() : $a);
        return ($a == null ? new \stdClass() : $a);
    }
public static function open(string $filepath):\stdClass
    {
        if ($filepath == self::$filepath && self::$file != null) {
            return (self::$file);
        }

        if (!file_exists($filepath)) {
            throw new Server500(new \ArrayObject(array("explain" => "Cannot open file $filepath : File does not exist",
                "solution" => "Please set the correct filepath")));
        }

        if (!is_readable($filepath)) {
            throw new Server500(new \ArrayObject(array("explain" => "Cannot open file $filepath : File not readable",
                "solution" => "Please set the correct permission")));
        }

        $a = json_decode(file_get_contents($filepath));

        self::$file = ($a == null ? new \stdClass() : $a);
        return ($a == null ? new \stdClass() : $a);
    }
public static function open ( string $ filepath ) : \ stdClass { if ( $ filepath == self :: $ filepath && self :: $ file != null ) { return ( self :: $ file ) ; } if ( ! file_exists ( $ filepath ) ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Cannot open file $filepath : File does not exist" , "solution" => "Please set the correct filepath" ) ) ) ; } if ( ! is_readable ( $ filepath ) ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Cannot open file $filepath : File not readable" , "solution" => "Please set the correct permission" ) ) ) ; } $ a = json_decode ( file_get_contents ( $ filepath ) ) ; self :: $ file = ( $ a == null ? new \ stdClass ( ) : $ a ) ; return ( $ a == null ? new \ stdClass ( ) : $ a ) ; }
Open file configuration
@param $filepath string Filepath
@return \stdClass File content
@throws 5Server500 If file does not exist or not readable
Open file configuration