Removes the key if it is directory
@param string $key
@param boolean $recursive
@return mixed
@throws EtcdException
167855
public function rmdir($key, $recursive = false)
    {
        $query = array('dir' => 'true');

        if ($recursive === true) {
            $query['recursive'] = 'true';
        }

        try {
            $response = $this->guzzleclient->delete(
                $this->buildKeyUri($key),
                array(
                    'query' => $query
                )
            );
        } catch (BadResponseException $e) {
            $response = $e->getResponse();
        }
        $body = json_decode($response->getBody(), true);
        if (JSON_ERROR_NONE !== json_last_error()) {
            throw new RuntimeException('Unable to parse response body into JSON: ' . json_last_error());
        }

        if (isset($body['errorCode'])) {
            throw new EtcdException($body['message'], $body['errorCode']);
        }
        return $body;
    }
1004409
protected function removeAssetCache($file, $recursive)
    {
        $files = $this->asset->isJavascript($file) ? $this->asset->getParser()->javascriptFiles($file) : $this->asset->getParser()->stylesheetFiles($file);

        array_push($files, $this->asset->getParser()->absoluteFilePath($file));

        foreach ($files as $file)
        {
            $removed = $this->asset->getGenerator()->cachedFile($file)->remove();

            if ($removed === false) {
                $this->writeln(PHP_EOL . "<warning> failed to find/remove cache for {$file}</warning>");
            }
        }
    }
1081758
public function mkdir($dir, $recursive = false)
    {
        $dir = $this->_getAbsoluteRemotePath($dir);
        if (false === @mkdir($dir, 0777, $recursive)) {
            return $this->_trigger_error(sprintf('Unable to make directory: %s.', $dir));
        }

        return true;
    }
938292
public function remove( $key ) {
		if ( ! $this->enabled ) {
			return false;
		}

		$filename = $this->filename( $key );

		if ( file_exists( $filename ) ) {
			return unlink( $filename );
		}

		return false;
	}
269504
public function ls($key = '/', $recursive = false)
    {
        $this->values = array();
        $this->dirs = array();

        try {
            $data = $this->listDir($key, $recursive);
        } catch (EtcdException $e) {
            throw $e;
        }

        $iterator = new RecursiveArrayIterator($data);
        return $this->traversalDir($iterator);
    }
258319
public function remove($key)
    {
        $position = $this->getPosition($key);
        if (false !== $position) {
            $this->file->remove($position);
            $this->rebuildIndex();

            return true;
        }

        return false;
    }
1331656
static function accumulatorStop( $key, $recursive = false )
    {
        if ( !eZDebug::isDebugEnabled() )
            return;
        $stopTime = microtime( true );
        $debug = eZDebug::instance();
        $key = $key === false ? 'Default Debug-Accumulator' : $key;
        if ( ! array_key_exists( $key, $debug->TimeAccumulatorList ) )
        {
            eZDebug::writeWarning( "Accumulator '$key' does not exist, run eZDebug::accumulatorStart first", __METHOD__ );
            return;
        }
        $accumulator = $debug->TimeAccumulatorList[$key];
        if ( $recursive )
        {
            if ( isset( $accumulator['recursive_counter'] ) )
            {
                if ( $accumulator['recursive_counter'] > 0 )
                {
                    $accumulator['recursive_counter']--;
                    return;
                }
            }
        }
        $diffTime = $stopTime - $accumulator['temp_time'];
        $accumulator['time'] = $accumulator['time'] + $diffTime;
        ++$accumulator['count'];
        $debug->TimeAccumulatorList[$key] = $accumulator;
    }
318054
public function destroy($recursive = true)
    {
        if ($recursive) {
            foreach ($this->elements as $el) {
                if ($el instanceof self) {
                    $el->destroy();
                }
            }
        }
        /*
        if (@$this->model && $this->model instanceof AbstractObject) {
            $this->model->destroy();
            unset($this->model);
        }
        if (@$this->controller && $this->controller instanceof AbstractObject) {
            $this->controller->destroy();
            unset($this->controller);
        }
        */
        $this->owner->_removeElement($this->short_name);
    }
419192
public function delete($path, $recursive = false)
    {
        if ($path instanceof FileInfoInterface) {
            $path = $path->getRelativePath();
        }

        $info = $this->info($path);
        if (!$info->exists()) {
            return $this;
        }

        if (!$info->isDir()) {
            if (!unlink($info->getStreamUrl())) {
                throw new RuntimeException(sprintf(
                    'Failed to delete file "%s": %s',
                    $path, $this->getLastPhpError()
                ));
            }

            return $this;
        }

        if ($recursive) {
            $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($info->getStreamUrl()), RecursiveIteratorIterator::CHILD_FIRST);

            /* @var $child FileInfoInterface */
            foreach ($iterator as $child) {
                if ($child->isDir()) {
                    $result = @rmdir($child->getStreamUrl());
                } else {
                    $result = @unlink($child->getStreamUrl());
                }

                if (!$result) {
                    throw new RuntimeException(sprintf(
                        'Failed to remove entry "%s": %s',
                        $child->getRelativePath(), $this->getLastPhpError()
                    ));
                }
            }
        }

        if (!rmdir($info->getStreamUrl())) {
            throw new RuntimeException(sprintf(
                'Failed to remove directory "%s": %s',
                $path, $this->getLastPhpError()
            ));
        }

        return $this;
    }
304837
public function ifDirDoesNotExistCreate($directory, $recursive = false)
    {
        if ($this->isDir($directory) === false) {
            $this->mkdir($directory, $recursive);

            return true;
        } else {
            return false;
        }
    }
1244158
public function delete($key)
    {
        $filename = $this->cacheDir . DIRECTORY_SEPARATOR . $this->processKey($key);

        return unlink($filename);
    }
233135
public function remove($key): self
    {
        // recursive call
        if (\is_array($key)) {
            foreach ($key as $k) {
                $this->internalRemove($k);
            }

            return static::create(
                $this->getArray(),
                $this->iteratorClass,
                false
            );
        }

        $this->internalRemove($key);

        return static::create(
            $this->getArray(),
            $this->iteratorClass,
            false
        );
    }
1191341
public static function forget($key)
    {
        $filename = static::makeHashFilename($key);

        if (!file_exists($filename)) {
            return false;
        }

        $r = (bool) @unlink($filename);

        $parts = explode('/', $filename);

        array_pop($parts);

        $dirname = implode('/', $parts);

        if (is_dir($dirname)) {
            @rmdir($dirname);
        }

        return $r;
    }
205678
function dispose($recursive = false) {
    
    if ( $recursive ) {
      while ( $child = $this->get_first_child() )
        $child->dispose(true);
    }
    
    $this->_root = null;
    unset($this->_root);
    
    $this->_frame->dispose(true);
    $this->_frame = null;
    unset($this->_frame);
    
    $this->_positioner = null;
    unset($this->_positioner);
    
    $this->_reflower = null;
    unset($this->_reflower);
  }
45207
public function deleteFolder($folderName, $recursive = false)
    {
        //check whether folder is set or not
        if ($folderName == '')
            throw new Exception('No folder name specified');

        //build URI
        $strURI = $this->strURIFolder . $folderName;
        if ($recursive) {
            $strURI = $strURI . "?recursive=true";
        }

        //sign URI
        $signedURI = Utils::sign($strURI);

        $responseStream = json_decode(Utils::processCommand($signedURI, 'DELETE', '', ''));
        if ($responseStream->Code != 200) {
            return FALSE;
        }
        return TRUE;
    }
373576
public function scanDir($directory = '.', $recursive = false)
    {
        return $this->parseRawList($this->rawlist($directory, $recursive));
    }
408660
public function listWith(array $keys = [], $directory = '', $recursive = false)
    {
        list($prefix, $directory) = $this->getPrefixAndPath($directory);
        $arguments = [$keys, $directory, $recursive];

        return $this->invokePluginOnFilesystem('listWith', $arguments, $prefix);
    }