protected function setMode($mode) {
    $mode = strtolower($mode);

    // These are largely ignored, as the remote
    // object storage does not distinguish between
    // text and binary files. Per the PHP recommendation
    // files are treated as binary.
    $this->isBinary = strpos($mode, 'b') !== FALSE;
    $this->isText = strpos($mode, 't') !== FALSE;

    // Rewrite mode to remove b or t:
    $mode = preg_replace('/[bt]?/', '', $mode);

    switch ($mode) {
      case 'r+':
        $this->isWriting = TRUE;
      case 'r':
        $this->isReading = TRUE;
        $this->createIfNotFound = FALSE;
        break;


      case 'w+':
        $this->isReading = TRUE;
      case 'w':
        $this->isTruncating = TRUE;
        $this->isWriting = TRUE;
        break;


      case 'a+':
        $this->isReading = TRUE;
      case 'a':
        $this->isAppending = TRUE;
        $this->isWriting = TRUE;
        break;


      case 'x+':
        $this->isReading = TRUE;
      case 'x':
        $this->isWriting = TRUE;
        $this->noOverwrite = TRUE;
        break;

      case 'c+':
        $this->isReading = TRUE;
      case 'c':
        $this->isWriting = TRUE;
        break;

      // nope mode: Mock read/write support,
      // but never write to the remote server.
      // (This is accomplished by never marking
      // the stream as dirty.)
      case 'nope':
        $this->isReading = TRUE;
        $this->isWriting = TRUE;
        $this->isNeverDirty = TRUE;
        break;

      // Default case is read/write
      // like c+.
      default:
        $this->isReading = TRUE;
        $this->isWriting = TRUE;
        break;

    }

    return $this;
  }
protected function setMode($mode) {
    $mode = strtolower($mode);

    // These are largely ignored, as the remote
    // object storage does not distinguish between
    // text and binary files. Per the PHP recommendation
    // files are treated as binary.
    $this->isBinary = strpos($mode, 'b') !== FALSE;
    $this->isText = strpos($mode, 't') !== FALSE;

    // Rewrite mode to remove b or t:
    $mode = preg_replace('/[bt]?/', '', $mode);

    switch ($mode) {
      case 'r+':
        $this->isWriting = TRUE;
      case 'r':
        $this->isReading = TRUE;
        $this->createIfNotFound = FALSE;
        break;


      case 'w+':
        $this->isReading = TRUE;
      case 'w':
        $this->isTruncating = TRUE;
        $this->isWriting = TRUE;
        break;


      case 'a+':
        $this->isReading = TRUE;
      case 'a':
        $this->isAppending = TRUE;
        $this->isWriting = TRUE;
        break;


      case 'x+':
        $this->isReading = TRUE;
      case 'x':
        $this->isWriting = TRUE;
        $this->noOverwrite = TRUE;
        break;

      case 'c+':
        $this->isReading = TRUE;
      case 'c':
        $this->isWriting = TRUE;
        break;

      // nope mode: Mock read/write support,
      // but never write to the remote server.
      // (This is accomplished by never marking
      // the stream as dirty.)
      case 'nope':
        $this->isReading = TRUE;
        $this->isWriting = TRUE;
        $this->isNeverDirty = TRUE;
        break;

      // Default case is read/write
      // like c+.
      default:
        $this->isReading = TRUE;
        $this->isWriting = TRUE;
        break;

    }

    return $this;
  }
protected function setMode ( $ mode ) { $ mode = strtolower ( $ mode ) ; // These are largely ignored, as the remote // object storage does not distinguish between // text and binary files. Per the PHP recommendation // files are treated as binary. $ this -> isBinary = strpos ( $ mode , 'b' ) !== FALSE ; $ this -> isText = strpos ( $ mode , 't' ) !== FALSE ; // Rewrite mode to remove b or t: $ mode = preg_replace ( '/[bt]?/' , '' , $ mode ) ; switch ( $ mode ) { case 'r+' : $ this -> isWriting = TRUE ; case 'r' : $ this -> isReading = TRUE ; $ this -> createIfNotFound = FALSE ; break ; case 'w+' : $ this -> isReading = TRUE ; case 'w' : $ this -> isTruncating = TRUE ; $ this -> isWriting = TRUE ; break ; case 'a+' : $ this -> isReading = TRUE ; case 'a' : $ this -> isAppending = TRUE ; $ this -> isWriting = TRUE ; break ; case 'x+' : $ this -> isReading = TRUE ; case 'x' : $ this -> isWriting = TRUE ; $ this -> noOverwrite = TRUE ; break ; case 'c+' : $ this -> isReading = TRUE ; case 'c' : $ this -> isWriting = TRUE ; break ; // nope mode: Mock read/write support, // but never write to the remote server. // (This is accomplished by never marking // the stream as dirty.) case 'nope' : $ this -> isReading = TRUE ; $ this -> isWriting = TRUE ; $ this -> isNeverDirty = TRUE ; break ; // Default case is read/write // like c+. default : $ this -> isReading = TRUE ; $ this -> isWriting = TRUE ; break ; } return $ this ; }
Set the fopen mode.

@param string $mode
The mode string, e.g. `r+` or `wb`.

@retval HPCloud::Storage::ObjectStorage::StreamWrapper
@return \HPCloud\Storage\ObjectStorage\StreamWrapper
$this so the method can be used in chaining.
Set the fopen mode .