Remove a structure

@param   string|array|\Paragraph\Model\Snippet\Structure $structureOrName
@return  int
194643
public function delete( $structureOrName )
    {
        $path = $this->getSavePath();

        if ( is_object( $structureOrName ) )
        {
            $name = $structureOrName->name;
        }
        else if ( is_array( $structureOrName ) )
        {
            $name = $structureOrName['name'];
        }
        else
        {
            $name = (string) $structureOrName;
        }

        if ( ! is_file( $path . $name ) )
        {
            return 0;
        }

        return (int) @ unlink( $path . $name );
    }
279821
protected static int removeTreeStructure(BinaryTree curStruc) {

        BinaryTree equalStruc = curStruc.getEqual();
        BinaryTree notEqualStruc = curStruc.getNotEqual();
        curStruc = null;

        if (equalStruc != null) {
            removeTreeStructure(equalStruc);
        }

        if (notEqualStruc != null) {
            removeTreeStructure(notEqualStruc);
        }

        return 0;
    }
352179
private void deleteResource(final CmsUUID structureId) {

        CmsRpcAction<Void> action = new CmsRpcAction<Void>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                CmsCoreProvider.getVfsService().deleteResource(structureId, this);

            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(Void result) {

                onAfterDeletion();
            }
        };
        action.execute();
    }
559099
private function buildSelectForStructures($locale, $structures, &$names)
    {
        $result = '';
        // add node name and url to selector
        /** @var StructureInterface $structure */
        foreach ($structures as $structure) {
            $result .= $this->buildSelectForStructure($locale, $structure, $names);
        }

        return $result;
    }
690303
public static function buildStructure($array, Structure $structure)
    {
        switch ($structure->getType()) {
            case Structure::TYPE_LIST:
                $result = self::buildList($array, $structure);
                break;
            case Structure::TYPE_ARRAY:
                $result = self::buildArray($array, $structure);
                break;
            default:
                throw new Exception('Unknown structure type ' . $structure->getType());
        }

        return $result;
    }
891319
protected function parseHeader($structure, $document)
    {
        $elements = array();
        $count    = count($structure);

        for ($position = 0; $position < $count; $position += 2) {
            $name  = $structure[$position][1];
            $type  = $structure[$position + 1][0];
            $value = $structure[$position + 1][1];

            $elements[$name] = $this->parseHeaderElement($type, $value, $document);
        }

        return new Header($elements, $document);
    }
187844
private function resolveContent(StructureInterface $structure, array $data)
    {
        $structure->setWebspaceKey($this->getWebspaceKey());

        $content = [];
        foreach ($structure->getProperties(true) as $child) {
            if (array_key_exists($child->getName(), $data)) {
                $child->setValue($data[$child->getName()]);
            }

            $contentType = $this->contentTypeManager->get($child->getContentTypeName());
            $content[$child->getName()] = $contentType->getContentData($child);
        }

        return $content;
    }
827029
private function loadStructure(\SimpleXMLElement $structureNode)
    {
        $structure = new ElementStructure();

        $attr = $structureNode->attributes();

        $structure
            ->setId((int) $attr['id'])
            ->setName((string) $attr['name'])
            ->setParentName((string) $attr['parentName'])
            ->setDsId((string) $attr['dsId']);

        foreach ($structureNode->structure as $subStructureNode) {
            $structure->addStructure($this->loadStructure($subStructureNode));
        }

        foreach ($structureNode->value as $valueNode) {
            $attr = $valueNode->attributes();
            $value = (string) $valueNode;
            if ((string) $attr['dataType'] === 'array') {
                $value = json_decode($value, true);
            }

            $structure->setValue(
                new ElementStructureValue(
                    (string) $attr['id'],
                    (string) $attr['dsId'],
                    (string) $attr['language'],
                    (string) $attr['type'],
                    (string) $attr['dataType'],
                    (string) $attr['name'],
                    $value
                )
            );
        }

        return $structure;
    }
690461
protected function documentToStructure(StructureBehavior $document)
    {
        return new $this(
            $this->inspector->getStructureMetadata($document),
            $this->inspector,
            $this->propertyFactory,
            $document
        );
    }
466793
public function delete( $tagOrId )
    {
        if ( is_numeric( $tagOrId ) )
        {
            $tag = $this->find( (int) $tagOrId );
        }
        else if ( is_scalar( $tagOrId ) )
        {
            $tag = $this->findByName( (string) $tagOrId );
        }
        else if ( is_array( $tagOrId ) )
        {
            if ( ! empty( $tagOrId['id'] ) )
            {
                $tag = $this->find( (int) $tagOrId['id'] );
            }
            else if ( ! empty( $tagOrId['name'] ) )
            {
                $tag = $this->findByName( (string) $tagOrId['name'] );
            }
        }
        else if ( $tagOrId instanceof Structure )
        {
            $tag = $tagOrId;
        }

        if ( empty( $tag ) )
        {
            return 0;
        }

        return parent::delete( $tag );
    }
1019274
public function remove($nodeName)
    {
        $children = self::removeTreeNode($this->hierarchy, $nodeName);
        // @todo remove all children
        $this->removeNodeFromList($nodeName);
        $this->updateRequired = true;

        return $this;
    }
803051
public function delete( $structureOrPrimaryKeys )
    {
        if ( is_object( $structureOrPrimaryKeys ) )
        {
            $section = $structureOrPrimaryKeys->section;
        }
        else if ( is_array( $structureOrPrimaryKeys ) )
        {
            $section = $structureOrPrimaryKeys['section'];
        }
        else
        {
            $section = (string) $structureOrPrimaryKeys;
        }

        $rows = 0;
        $def  = $this->getDefinitions();
        $keys = $def->getKeys( $section );

        if ( ! empty( $keys ) )
        {
            $delete = $this->sql()
                           ->delete()
                           ->where( $this->keysWhere( $keys ) );

            $result = $this->sql()
                           ->prepareStatementForSqlObject( $delete )
                           ->execute();

            $rows += $result->getAffectedRows();
        }

        $fieldsets = $def->getFieldsets( $section );

        if ( ! empty( $fieldsets ) )
        {
            foreach ( $fieldsets as $fieldset )
            {
                $rows += $this->delete( $fieldset );
            }
        }

        return $rows;
    }
990157
public function section_shuffle_questions(structure $structure, $section) {
        $checkboxattributes = array(
            'type' => 'checkbox',
            'id' => 'shuffle-' . $section->id,
            'value' => 1,
            'data-action' => 'shuffle_questions',
            'class' => 'cm-edit-action',
        );

        if (!$structure->can_be_edited()) {
            $checkboxattributes['disabled'] = 'disabled';
        }
        if ($section->shufflequestions) {
            $checkboxattributes['checked'] = 'checked';
        }

        if ($structure->is_first_section($section)) {
            $help = $this->help_icon('shufflequestions', 'quiz');
        } else {
            $help = '';
        }

        $helpspan = html_writer::span($help, 'shuffle-help-tip');
        $progressspan = html_writer::span('', 'shuffle-progress');
        $checkbox = html_writer::empty_tag('input', $checkboxattributes);
        $label = html_writer::label(get_string('shufflequestions', 'quiz'),
                $checkboxattributes['id'], false);
        return html_writer::span($progressspan . $checkbox . $label. ' ' . $helpspan,
                'instanceshufflequestions', array('data-action' => 'shuffle_questions'));
    }
350413
public function prune($structureNode = null)
    {
        if ($structureNode) {
            $this->addUsingAlias(StructureNodeTableMap::COL_ID, $structureNode->getId(), Criteria::NOT_EQUAL);
        }

        return $this;
    }
1023209
public static boolean removeAlgorithm(String name) {
		ListIterator<StructureAlignment> algIt = algorithms.listIterator();
		while(algIt.hasNext()) {
			StructureAlignment alg = algIt.next();
			if(alg.getAlgorithmName().equalsIgnoreCase(name)) {
				algIt.remove();
				return true;
			}
		}
		return false;
	}
217227
public function removeNode( $nodePath )
	{
		$pathNodes	= explode( "/", $nodePath );
		$nodeName	= array_pop( $pathNodes );
		$nodePath	= implode( "/", $pathNodes );
		$nodeNumber	= 0;
		$branch		= $this->getNode( $nodePath );
		if( preg_match_all( "@^(.*)\[([0-9]+)\]$@", $nodeName, $matches ) )
		{
			$nodeName	= $matches[1][0];
			$nodeNumber	= $matches[2][0];
		}
		$nodes		=& $branch->getChildren();
		$index		= -1;
		for( $i=0; $i<count( $nodes ); $i++ )
		{
			if( !$nodeName || $nodes[$i]->getNodeName() == $nodeName )
			{
				$index++;
				if( $index != $nodeNumber ) 
					continue;
				unset( $nodes[$i] );
				return (bool) $this->write();
			}
		}
		throw new InvalidArgumentException( 'Node not found.' );
	}
414632
public function remove( Structure $package )
    {
        $data = static::loadPackageData();

        if ( ! isset( $data['require'][$package->name] ) )
        {
            return false;
        }

        unset( $data['require'][$package->name] );
        return static::savePackageData( $data );
    }