original_string: protected function _setKey($key, $createKey = false)
      {
          $groups = null;
          if ($this->_groupPrefix) {
              $groups = vsprintf($this->_groupPrefix, $this->groups());
          }
          $dir = $this->_config['path'] . $groups;
  
          if (!is_dir($dir)) {
              mkdir($dir, 0775, true);
          }
  
          $path = new SplFileInfo($dir . $key);
  
          if (!$createKey && !$path->isFile()) {
              return false;
          }
          if (empty($this->_File) ||
              $this->_File->getBasename() !== $key ||
              $this->_File->valid() === false
          ) {
              $exists = file_exists($path->getPathname());
              try {
                  $this->_File = $path->openFile('c+');
              } catch (Exception $e) {
                  trigger_error($e->getMessage(), E_USER_WARNING);
  
                  return false;
              }
              unset($path);
  
              if (!$exists && !chmod($this->_File->getPathname(), (int)$this->_config['mask'])) {
                  trigger_error(sprintf(
                      'Could not apply permission mask "%s" on cache file "%s"',
                      $this->_File->getPathname(),
                      $this->_config['mask']
                  ), E_USER_WARNING);
              }
          }
  
          return true;
      }
code: protected function _setKey($key, $createKey = false)
      {
          $groups = null;
          if ($this->_groupPrefix) {
              $groups = vsprintf($this->_groupPrefix, $this->groups());
          }
          $dir = $this->_config['path'] . $groups;
  
          if (!is_dir($dir)) {
              mkdir($dir, 0775, true);
          }
  
          $path = new SplFileInfo($dir . $key);
  
          if (!$createKey && !$path->isFile()) {
              return false;
          }
          if (empty($this->_File) ||
              $this->_File->getBasename() !== $key ||
              $this->_File->valid() === false
          ) {
              $exists = file_exists($path->getPathname());
              try {
                  $this->_File = $path->openFile('c+');
              } catch (Exception $e) {
                  trigger_error($e->getMessage(), E_USER_WARNING);
  
                  return false;
              }
              unset($path);
  
              if (!$exists && !chmod($this->_File->getPathname(), (int)$this->_config['mask'])) {
                  trigger_error(sprintf(
                      'Could not apply permission mask "%s" on cache file "%s"',
                      $this->_File->getPathname(),
                      $this->_config['mask']
                  ), E_USER_WARNING);
              }
          }
  
          return true;
      }
code_tokens: protected function _setKey ( $ key , $ createKey = false ) { $ groups = null ; if ( $ this -> _groupPrefix ) { $ groups = vsprintf ( $ this -> _groupPrefix , $ this -> groups ( ) ) ; } $ dir = $ this -> _config [ 'path' ] . $ groups ; if ( ! is_dir ( $ dir ) ) { mkdir ( $ dir , 0775 , true ) ; } $ path = new SplFileInfo ( $ dir . $ key ) ; if ( ! $ createKey && ! $ path -> isFile ( ) ) { return false ; } if ( empty ( $ this -> _File ) || $ this -> _File -> getBasename ( ) !== $ key || $ this -> _File -> valid ( ) === false ) { $ exists = file_exists ( $ path -> getPathname ( ) ) ; try { $ this -> _File = $ path -> openFile ( 'c+' ) ; } catch ( Exception $ e ) { trigger_error ( $ e -> getMessage ( ) , E_USER_WARNING ) ; return false ; } unset ( $ path ) ; if ( ! $ exists && ! chmod ( $ this -> _File -> getPathname ( ) , ( int ) $ this -> _config [ 'mask' ] ) ) { trigger_error ( sprintf ( 'Could not apply permission mask "%s" on cache file "%s"' , $ this -> _File -> getPathname ( ) , $ this -> _config [ 'mask' ] ) , E_USER_WARNING ) ; } } return true ; }
docstring: Sets the current cache key this class is managing, and creates a writable SplFileObject
  for the cache file the key is referring to.
  
  @param string $key The key
  @param bool $createKey Whether the key should be created if it doesn't exists, or not
  @return bool true if the cache key could be set, false otherwise
docstring_tokens: Sets the current cache key this class is managing and creates a writable SplFileObject for the cache file the key is referring to .