original_string: public function open(string $mode)
      {
          $read = strpbrk($mode, "r+") !== false;
          $write = strpbrk($mode, "waxc+") !== false;
          $x = strpbrk($mode, "x") !== false;
  
          $path = $this->getFullPath();
          $fh = @fopen($path, $mode);
          if (is_resource($fh))
              return $fh;
  
          if ($x && file_exists($path))
              throw new IOException("File already exists: " . $path);
          if ($write && !is_writable($path))
              throw new IOException("File is not writable: " . $path);
          if ($read && !is_readable($path))
              throw new IOException("File is not readable: " . $path);
  
          throw new IOException("Invalid mode for opening file: " . $mode);
      }
code: public function open(string $mode)
      {
          $read = strpbrk($mode, "r+") !== false;
          $write = strpbrk($mode, "waxc+") !== false;
          $x = strpbrk($mode, "x") !== false;
  
          $path = $this->getFullPath();
          $fh = @fopen($path, $mode);
          if (is_resource($fh))
              return $fh;
  
          if ($x && file_exists($path))
              throw new IOException("File already exists: " . $path);
          if ($write && !is_writable($path))
              throw new IOException("File is not writable: " . $path);
          if ($read && !is_readable($path))
              throw new IOException("File is not readable: " . $path);
  
          throw new IOException("Invalid mode for opening file: " . $mode);
      }
code_tokens: public function open ( string $ mode ) { $ read = strpbrk ( $ mode , "r+" ) !== false ; $ write = strpbrk ( $ mode , "waxc+" ) !== false ; $ x = strpbrk ( $ mode , "x" ) !== false ; $ path = $ this -> getFullPath ( ) ; $ fh = @ fopen ( $ path , $ mode ) ; if ( is_resource ( $ fh ) ) return $ fh ; if ( $ x && file_exists ( $ path ) ) throw new IOException ( "File already exists: " . $ path ) ; if ( $ write && ! is_writable ( $ path ) ) throw new IOException ( "File is not writable: " . $ path ) ; if ( $ read && ! is_readable ( $ path ) ) throw new IOException ( "File is not readable: " . $ path ) ; throw new IOException ( "Invalid mode for opening file: " . $ mode ) ; }
docstring: Open the file for reading or writing, throwing informative
  exceptions when it fails.
  
  @param string $mode The file opening mode
  @return resource The opened file resource
  @throws IOException When opening the file failed.
  @seealso fopen
docstring_tokens: Open the file for reading or writing throwing informative exceptions when it fails .