public function chdir($dir, $check = true)
    {
        if (!is_string($dir)) {
            throw new InvalidArgumentException("string", 0);
        }

        if ($check && !is_dir($dir)) {
            throw new Exception("No such directory $dir");
        }

        $this->cwd = $dir;

        return $this;
    }
public function chdir($dir, $check = true)
    {
        if (!is_string($dir)) {
            throw new InvalidArgumentException("string", 0);
        }

        if ($check && !is_dir($dir)) {
            throw new Exception("No such directory $dir");
        }

        $this->cwd = $dir;

        return $this;
    }
public function chdir ( $ dir , $ check = true ) { if ( ! is_string ( $ dir ) ) { throw new InvalidArgumentException ( "string" , 0 ) ; } if ( $ check && ! is_dir ( $ dir ) ) { throw new Exception ( "No such directory $dir" ) ; } $ this -> cwd = $ dir ; return $ this ; }
Set the command's new working directory

@param string $dir The new working directory
@param bool $check If $dir should be choked for existence
@return $this
@throws Exception If $dir does not exist or is not a directory
@throws InvalidArgumentException If $dir is not a string
Set the command s new working directory