original_string: public function setCacheDirectory($directory)
      {
          if (!is_dir($directory)) {
              $this->createDirectory($directory);
          }
  
          if (!is_writable($directory)) {
              throw new \InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir));
          }
  
          $this->cacheDirectory = $directory;
  
          return $this;
      }
code: public function setCacheDirectory($directory)
      {
          if (!is_dir($directory)) {
              $this->createDirectory($directory);
          }
  
          if (!is_writable($directory)) {
              throw new \InvalidArgumentException(sprintf('The cache directory "%s" is not writable.', $dir));
          }
  
          $this->cacheDirectory = $directory;
  
          return $this;
      }
code_tokens: public function setCacheDirectory ( $ directory ) { if ( ! is_dir ( $ directory ) ) { $ this -> createDirectory ( $ directory ) ; } if ( ! is_writable ( $ directory ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The cache directory "%s" is not writable.' , $ dir ) ) ; } $ this -> cacheDirectory = $ directory ; return $ this ; }
docstring: Set cache directory
  
  @param string $directory
  @return OpenGraphGeneratorBuilder
docstring_tokens: Set cache directory