Removes the key if it is directory

@param string  $key
@param boolean $recursive
@return mixed
@throws EtcdException
335277
public function removeDir($key, $recursive = false)
    {
        $query = ['dir' => 'true'];

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

        return $this->httpDelete($this->server . $this->getKeyPath($key), $query);
    }
470039
public function listWith(array $keys = [], $directory = '', $recursive = false)
    {
        [$fs, $directory] = $this->getFilesystemAndPath($directory);

        return $fs->listWith($keys, $directory, $recursive);
    }
283670
public function clear(string $key = ''): bool {
		if ($key === '') {
			$this->recursiveDeleteDirectory($this->storageCachePath);
			return true;
		}
		$cacheDir = $this->storageCachePath . $key;
		$dirName  = dirname($cacheDir);
		$find     = str_replace($dirName . '/', '', $cacheDir);
		if (is_dir($dirName) && $dirArray = scandir($dirName)) {
			foreach ($dirArray as $k => $v) {
				if ($v !== '.' && $v !== '..') {
					if (is_dir($dirName . '/' . $v) && (strpos($v, $find) === 0)) {
						$this->recursiveDeleteDirectory($dirName . '/' . $v);
						rmdir($dirName . '/' . $v);
					}
					elseif (strpos($v, $find) === 0) {
						unlink($dirName . '/' . $v);
					}
				}
			}
		}
		return true;
	}
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;
    }
578052
public function dirInfo($key = '/', $recursive = false)
    {
        $query = [];
        if ($recursive === true) {
            $query['recursive'] = 'true';
        }

        return $this->httpGet($this->getKeyUrl($key), $query);
    }
938292
public function remove( $key ) {
		if ( ! $this->enabled ) {
			return false;
		}

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

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

		return false;
	}
1373111
public function remove($key)
    {
        if ($this->has($key)) {
            return wincache_ucache_delete($key);
        } else {
            throw new RuntimeException(sprintf(
                'Attempted to delete non-existing key "%s"', $key
            ));
        }
    }
1067808
public function listWith(array $keys = [], $directory = '', $recursive = false)
    {
        $contents = $this->listContents($directory, $recursive);

        foreach ($contents as $index => $object) {
            if ($object['type'] === 'file') {
                $missingKeys = \array_diff($keys, \array_keys($object));
                $contents[$index] = \array_reduce($missingKeys, [$this, 'getMetadataByName'], $object);
            }
        }

        return $contents;
    }
1089039
public function delete($recursive = false)
    {
        $fs = FileSystem::getFileSystem();
        if ($fs->canDelete($this) !== true) {
            throw new IOException("Cannot delete " . $this->path . "\n");
        }

        $fs->delete($this, $recursive);
    }
27439
public function delete(bool $recursive = true): bool
    {
        $this->each(function (Folder $item) use ($recursive) {
            $item->delete($recursive);
        });

        return true;
    }
970583
public function remove($path, $recursive, $force)
    {
        $this->clearAll();

        $path = trim($path);
        if (!$this->validatePath($path)) {
            throw new \InvalidArgumentException('Invalid path');
        }

        $this->addCommandName(self::GIT_REMOVE);

        if ($recursive) {
            $this->addCommandArgument('-r');
        }

        if ($force) {
            $this->addCommandArgument('-f');
        }

        $this->addPath($path);

        return $this->getCommand();
    }
984288
public function toObject(bool $recursive = false) : \stdClass
    {
        $o = new \stdClass();
        if (!$recursive) {
            foreach ($this->explorableIndex as $property) {
                $o->{$property} = $this->{$property};
            }
        } else {
            foreach ($this->explorableIndex as $property) {
                $value = $this->{$property};
                $o->{$property} = !($value instanceof Explorable) ? $value : $value->toObject(true);
            }
        }
        return $o;
    }
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
        );
    }
1100658
function remove($ID, $Recursive = false)
	{
		$this->unassignPermissions ( $ID );
		$this->unassignUsers ( $ID );
		if (! $Recursive)
			return $this->roles->deleteConditional ( "ID=?", $ID );
		else
			return $this->roles->deleteSubtreeConditional ( "ID=?", $ID );
	}
255520
public function removeFile($key)
    {
        if (isset($this->files[$key])) {
            unset($this->files[$key]);
            return true;
        } else {
            return false;
        }
    }
103504
public function remove($key)
    {
        $result = parent::remove($key);
        if ($result) {
            $this->invalidateResolverCache();
        }

        return $result;
    }
241245
public function isAssoc(bool $recursive = false): bool
    {
        if ($this->isEmpty()) {
            return false;
        }

        foreach ($this->keys($recursive)->getGenerator() as $key) {
            if (!\is_string($key)) {
                return false;
            }
        }

        return true;
    }