public function openFile($path, $mode = 'r') {
		// Open the file
		if (! is_file($path)) {
			return false;
		}
		
		$file = fopen($path, $mode);
		
		if ($file === false) {
			throw new OperationFailed('Unable to open the file: ' . $path);
		}
		
		// Process the expire time
		$expire = fread($file, self::OPTIONS_OFFSET - 1);
		
		if ($expire === false) {
			fclose($file);
			throw new OperationFailed('Unable to get the cache content from: ' . $path);
		}
		
		if (! preg_match('/^\d{10}$/', $expire)) {
			fclose($file);
			throw new OperationFailed('Expire time is corrupted');
		}
		
		$expire = (int) $expire;
		
		if ($expire !== 0 && $expire <= time()) {
			fclose($file);
			
			if (unlink($path) === false) {
				throw new OperationFailed('Unable to delete the expired file: ' . $path);
			}
			
			return false;
		}
		
		return $file;
	}
public function openFile($path, $mode = 'r') {
		// Open the file
		if (! is_file($path)) {
			return false;
		}
		
		$file = fopen($path, $mode);
		
		if ($file === false) {
			throw new OperationFailed('Unable to open the file: ' . $path);
		}
		
		// Process the expire time
		$expire = fread($file, self::OPTIONS_OFFSET - 1);
		
		if ($expire === false) {
			fclose($file);
			throw new OperationFailed('Unable to get the cache content from: ' . $path);
		}
		
		if (! preg_match('/^\d{10}$/', $expire)) {
			fclose($file);
			throw new OperationFailed('Expire time is corrupted');
		}
		
		$expire = (int) $expire;
		
		if ($expire !== 0 && $expire <= time()) {
			fclose($file);
			
			if (unlink($path) === false) {
				throw new OperationFailed('Unable to delete the expired file: ' . $path);
			}
			
			return false;
		}
		
		return $file;
	}
public function openFile ( $ path , $ mode = 'r' ) { // Open the file if ( ! is_file ( $ path ) ) { return false ; } $ file = fopen ( $ path , $ mode ) ; if ( $ file === false ) { throw new OperationFailed ( 'Unable to open the file: ' . $ path ) ; } // Process the expire time $ expire = fread ( $ file , self :: OPTIONS_OFFSET - 1 ) ; if ( $ expire === false ) { fclose ( $ file ) ; throw new OperationFailed ( 'Unable to get the cache content from: ' . $ path ) ; } if ( ! preg_match ( '/^\d{10}$/' , $ expire ) ) { fclose ( $ file ) ; throw new OperationFailed ( 'Expire time is corrupted' ) ; } $ expire = ( int ) $ expire ; if ( $ expire !== 0 && $ expire <= time ( ) ) { fclose ( $ file ) ; if ( unlink ( $ path ) === false ) { throw new OperationFailed ( 'Unable to delete the expired file: ' . $ path ) ; } return false ; } return $ file ; }
Open the file

@param  string $path
@param  string $mode
@return resource | bool
Open the file