Delete a branch by its name

@param string $name  The branch to delete
@param bool   $force Force the delete

@throws \RuntimeException
@return string the command
974955
public function delete($name, $force = false)
    {
        $arg = ($force === true) ? '-D' : '-d';
        $this->clearAll();
        $this->addCommandName(self::BRANCH_COMMAND);
        $this->addCommandArgument($arg);
        $this->addCommandSubject($name);

        return $this->getCommand();
    }
1364567
public function del($term, $force = null)
    {
        if (false === $this->has_table()) return false;

        $force !== null or $force = $this->is_destructive;

        $term = $this->normalize_term($term);

        if (true === $force) {
            $return = $this->db->delete($this->table, $term);
        } else {
            $return = $this->trash_it($term, true);
        }

        if ( ! $return) {
            $this->set_error($this->db->error());
            return false;
        }

        return $return;
    }
10551
public function removeAction($name)
    {

        if (isset($this->actions[$name])) {
            unset($this->actions[$name]);
        }

        return $this;
    }
618401
public function remove($force = false)
    {
        $isEmpty = $this->isEmpty();
        if ($force && !$isEmpty) {
            $it = new \RecursiveDirectoryIterator($this->dir, \RecursiveDirectoryIterator::SKIP_DOTS);
            $files = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST);
            foreach($files as $file) {
                if ($file->isDir()){
                    \rmdir($file->getRealPath());
                } else {
                    \unlink($file->getRealPath());
                }
            }

            \rmdir($this->dir);
            $this->removed = true;

            return;
        }

        if ($isEmpty) {
            \rmdir($this->dir);
            $this->removed = true;
        }
    }
245363
public function delete($name)
    {
        $path = explode('.', $name);
        $key = array_shift($path);

        if ($path) {
            if ($this->checkCache($key) && $this->cache[$key]->delete($path)) {
                return $this->updateRecord($key);
            }
            return false;
        }

        unset($this->cache[$key]);

        return $this->deleteRecord($key);
    }
1290962
public function make($name, $force = FALSE) {
        if (isset($this->singles[$name])) {
            return $this->singles[$name];
        }
        #获得实现提供者
        $closure = $this->getClosure($name);
        #获取实例
        $object = $this->build($closure, $name);
        #单例绑定
        if (isset($this->bindings[$name]['force']) && $this->bindings[$name]['force'] || $force) {
            $this->singles[$name] = $object;
        }
        return $object;
    }
1213096
function uninstall($name)
    {
	    $result = array();
    	$result['status'] = false;
	    try {
		    $JFusionAdmin = Factory::getAdmin($name);
		    if ($JFusionAdmin->isConfigured()) {
			    //if this plugin had been valid, call its uninstall function if it exists
			    $success = 0;
			    try {
				    list($success, $reasons) = $JFusionAdmin->uninstall();

				    $reason = '';
				    if (is_array($reasons)) {
					    $reason = implode('</li><li>' . $name . ': ', $reasons);
				    } else {
					    $reason = $name . ': ' . $reasons;
				    }
			    } catch (Exception $e) {
				    $reason = $e->getMessage();
			    }
			    if (!$success) {
				    throw new RuntimeException(Text::_('PLUGIN') . ' ' . $name . ' ' . Text::_('UNINSTALL') . ' ' . Text::_('FAILED') . ': ' . $reason);
			    }
		    }
		    $db = Factory::getDBO();

		    $query = $db->getQuery(true)
			    ->select('name , original_name')
			    ->from('#__jfusion')
			    ->where('name = ' . $db->quote($name));

		    $db->setQuery($query);
		    $plugin = $db->loadObject();

		    // delete raw
		    $query = $db->getQuery(true)
			    ->delete('#__jfusion')
			    ->where('name = ' . $db->quote($name));
		    $db->setQuery($query);
		    $db->execute();

		    $query = $db->getQuery(true)
			    ->delete('#__jfusion_users')
			    ->where('jname = ' . $db->quote($name));
		    $db->setQuery($query);
		    $db->execute();

		    $event = new Event('onInstallerPluginUninstall');
		    $event->addArgument('name', $name);
		    Factory::getDispatcher()->triggerEvent($event);

		    if ($plugin || !$plugin->original_name) {
			    $dir = JFusionFramework::getPluginPath($name);

			    if (!$name || !is_dir(Path::clean($dir))) {
				    throw new RuntimeException(Text::_('UNINSTALL_ERROR_PATH'));
			    } else {
				    /**
				     * ---------------------------------------------------------------------------------------------
				     * Remove Language files Processing Section
				     * ---------------------------------------------------------------------------------------------
				     */
				    // Get the extension manifest object
				    $manifest = $this->getManifest($dir);
				    if (is_null($manifest)) {
					    throw new RuntimeException(Text::_('INSTALL_NOT_VALID_PLUGIN'));
				    } else {
					    $this->manifest = $manifest;

					    // remove files
					    if (!Folder::delete($dir)) {
						    throw new RuntimeException(Text::_('UNINSTALL_ERROR_DELETE'));
					    } else {
						    //return success
						    $msg = Text::_('PLUGIN') . ' ' . $name . ' ' . Text::_('UNINSTALL') . ': ' . Text::_('SUCCESS');
						    $result['message'] = $msg;
						    $result['status'] = true;
					    }
				    }
			    }
		    }
	    } catch (Exception $e) {
		    $result['message'] = $name . ' ' . $e->getMessage();
		    $this->installer->abort($e->getMessage());
	    }
        return $result;
    }
1199506
public function purgeCache($force = FALSE) {

		if(($path = $this->getCachePath($force))) {
			foreach(glob($path. '*') as $f) {
				if(!unlink($f)) {
					throw new FilesystemFolderException(sprintf('Cache folder %s could not be purged!', $this->path . self::CACHE_PATH));
				}
			}
		}

	}
477099
public function deleteObject($name)
    {
        if (is_object($name) && $name instanceof Object) {
            $name = $name->getName();
        }

        $this->connection->makeRequest(Client::DELETE, array($this->name, $name));
    }
1249156
public function drop($name)
    {
        // check if a valid name and sequence exists
        if (! $name || ! $this->exists($name)) {
            return false;
        }

        return $this->connection->statement("
            declare
                e exception;
                pragma exception_init(e,-02289);
            begin
                execute immediate 'drop sequence {$name}';
            exception
            when e then
                null;
            end;");
    }
511045
public function remove(string $name, bool $force = false, bool $noprune = false)
    {
        $data = [
            'force' => $force,
            'noprune' => $noprune,
        ];

        $url = self::$base_url.'/'.$name.'?'.http_build_query($data);

        return self::$curl->delete($url);
    }
675071
public function getBranch($name)
    {
        return array_key_exists($name, $this->branchesList) ? $this->branchesList[$name] : null;
    }
310016
public function deleteComponentEntry($name)
	{
		if ($this->baseDb->tableExists('#__components'))
		{
			// Delete component entry
			$query = "DELETE FROM `#__components` WHERE `name` = " . $this->baseDb->quote($name);
			$this->baseDb->setQuery($query);
			$this->baseDb->query();

			$this->log(sprintf('Removed component entry for "%s"', $element));

			return true;
		}
		elseif ($this->baseDb->tableExists('#__extensions'))
		{
			$name = 'com_' . strtolower($name);
			// Delete component entry
			$query = "DELETE FROM `#__extensions` WHERE `name` = " . $this->baseDb->quote($name);
			$this->baseDb->setQuery($query);
			$this->baseDb->query();

			// Remove the component container in the assets table
			$asset = \Hubzero\Access\Asset::oneByName($name);
			if ($asset && $asset->get('id'))
			{
				$asset->destroy();
			}

			$this->log(sprintf('Removed extension entry for component "%s"', $element));

			if ($this->baseDb->tableExists('#__menu'))
			{
				// Check for an admin menu entry...if it's not there, create it
				$query = "DELETE FROM `#__menu` WHERE `menutype` = 'main' AND `title` = " . $this->baseDb->quote($name);
				$this->baseDb->setQuery($query);
				$this->baseDb->query();

				// Rebuild lft/rgt
				$this->rebuildMenu();

				$this->log(sprintf('Removed menu entry for component "%s"', $element));
			}

			return true;
		}

		return false;
	}
1055292
public function delete( $force = false ) {
		// If the object doesn't exist, there is nothing to delete
		// so we'll just return immediately and not do anything else.
		if ( ! $this->exists() ) {
			return;
		}

		// If the "prev_delete" filter returns false we'll bail out of the delete
		// and just return. Indicating that the delete failed.
		if ( false === apply_filters( $this->prefix( 'prev_delete' ), true ) ) {
			return;
		}

		/**
		 * Fires before a wp-object is deleted.
		 *
		 * @param static $wp_object Current object instance.
		 */
		do_action( $this->prefix( 'deleting' ), $this );

		$deleted = $this->perform_delete( $force );

		if ( $deleted ) {
			$this->clean_cache();

			// Now object will not exists.
			$this->exists = false;

			/**
			 * Fires after a WP_Object is deleted.
			 *
			 * @param int $object_id Object ID was deleted.
			 */
			do_action( $this->prefix( 'deleted' ), $this->get_id() );
		}

		return $deleted;
	}
883904
public function remove($name)
    {
        if (array_key_exists($name, $this->data)) {
            unset($this->data[$name]);
            $this->removeData[] = $name;
            return true;
        }

        return null;
    }
780039
function destroyManager($force=false)
    {
        if ($this->getManager($force) !== null) {
            $key = $this->getSessionKey();
            $this->session->del($key);
        }
    }
1160366
public static function factory($name)
    {
        if (!isset(self::$services[$name])) {
            throw new \RuntimeException("The service [$name] don't register.");
        }

        $service = self::$services[$name];

        if (\is_object($service) && method_exists($service, '__invoke')) {
            return $service();
        }

        return $service;
    }