delete calendar component from container

@author Kjell-Inge Gustafsson <ical@kigkonsult.se>
@since 2.0.4 - 2007-06-14
@param mixed $arg1 ordno / component type / component uid
@param mixed $arg2 optional, ordno if arg1 = component type
@return void
483063
function deleteComponent( $arg1, $arg2=FALSE  ) {
    $argType = $index = null;
    if ( ctype_digit( (string) $arg1 )) {
      $argType = 'INDEX';
      $index   = (int) $arg1 - 1;
    }
    elseif(( strlen( $arg1 ) <= strlen( 'vfreebusy' )) && ( FALSE === strpos( $arg1, '@' ))) {
      $argType = strtolower( $arg1 );
      $index   = ( !empty( $arg2 ) && ctype_digit( (string) $arg2 )) ? (( int ) $arg2 - 1 ) : 1;
    }
    $cix1dC = 0;
    foreach ( $this->components as $cix => $component) {
      unset( $component->propix );
      if(( 'INDEX' == $argType ) && ( $index == $cix )) {
        unset( $this->components[$cix] );
        return TRUE;
      }
      elseif( $argType == $component->objName ) {
        if( $index == $cix1dC ) {
          unset( $this->components[$cix] );
          return TRUE;
        }
        $cix1dC++;
      }
      elseif( !$argType && ($arg1 == $component->getProperty( 'uid' ))) {
        unset( $this->components[$cix] );
        return TRUE;
      }
    }
    return FALSE;
  }
130520
public function preRemove(LifecycleEventArgs $args)
    {
        if ($args->getObject() instanceof BlockInterface) {
            $this->getService($args)->preRemove($args->getObject());
        }
    }
185223
protected function removeArgumentsFromTemplateVariableContainer(array $arguments)
    {
        $templateVariableContainer = $this->getWidgetRenderingContext()->getTemplateVariableContainer();
        foreach ($arguments as $identifier => $value) {
            $templateVariableContainer->remove($identifier);
        }
    }
573310
public function deleteCalendar($calendarId)
    {
        if (!is_array($calendarId)) {
            throw new \InvalidArgumentException('The value passed to $calendarId is expected to be an array with a calendarId and an instanceId');
        }
        list($calendarId, $instanceId) = $calendarId;

        $stmt = $this->pdo->prepare('SELECT access FROM '.$this->calendarInstancesTableName.' where id = ?');
        $stmt->execute([$instanceId]);
        $access = (int) $stmt->fetchColumn();

        if (\Sabre\DAV\Sharing\Plugin::ACCESS_SHAREDOWNER === $access) {
            /**
             * If the user is the owner of the calendar, we delete all data and all
             * instances.
             **/
            $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarObjectTableName.' WHERE calendarid = ?');
            $stmt->execute([$calendarId]);

            $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarChangesTableName.' WHERE calendarid = ?');
            $stmt->execute([$calendarId]);

            $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarInstancesTableName.' WHERE calendarid = ?');
            $stmt->execute([$calendarId]);

            $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarTableName.' WHERE id = ?');
            $stmt->execute([$calendarId]);
        } else {
            /**
             * If it was an instance of a shared calendar, we only delete that
             * instance.
             */
            $stmt = $this->pdo->prepare('DELETE FROM '.$this->calendarInstancesTableName.' WHERE id = ?');
            $stmt->execute([$instanceId]);
        }
    }
1165476
public function deleteDirectory($arg) {
        foreach (func_get_args() as $name) {
            (new static($this->fullName.'/'.$name))->delete();
        }
        return true;
    }
633992
public function handleDelete(Args $args)
    {
        $repositoryPath = Path::makeAbsolute($args->getArgument('path'), $this->currentPath);

        if (!$this->repoManager->hasRootPathMapping($repositoryPath)) {
            throw new RuntimeException(sprintf(
                'The path "%s" is not mapped in the module "%s".',
                $repositoryPath,
                $this->modules->getRootModuleName()
            ));
        }

        $this->repoManager->removeRootPathMapping($repositoryPath);

        return 0;
    }
482451
function _delete (args) {
    // make sure args is object
    args = requireValidOptionalObject(args)
    // model must allow delete
    if (!defined(this.model.columns.d)) {
        throw this.error('delete not supported')
    }
    // instance must not already be deleted
    if (this.isDeleted) {
        throw this.error('record already deleted')
    }
    // check access to delete unless allow set
    if (!args.allow) {
        // get global access control instance
        var accessControl = ImmutableAccessControl.getGlobal()
        // check access
        var allow = accessControl.allowModel({
            action: 'delete',
            model: this.model.name,
            scope: this.scope,
            session: this.session,
        })
        // throw access denied error if not allowed
        if (!allow) {
            httpError(403, null, accessControl.audit)
        }
    }
    // set d(eleted) flag true
    args.delete = true
    // use update method to empty
    return this.updateMeta(args)
}
615286
public function delete(?string $id = null)
    {
        $this->request->allowMethod(['post', 'delete']);
        $calendar = $this->Calendars->get($id);

        if ($this->Calendars->delete($calendar)) {
            $this->Flash->success((string)__('The calendar has been deleted.'));
        } else {
            $this->Flash->error((string)__('The calendar could not be deleted. Please, try again.'));
        }

        return $this->redirect(['action' => 'index']);
    }
621770
public function removeArgument(IArgument $arg): IRequest
    {
        if ($arg instanceof IMergeableArgument) {
            if (!isset($this->mergeableArguments[$arg->getKey()])) {
                throw new \InvalidArgumentException("This argument doesn't exists");
            }
            $this->mergeableArguments[$arg->getKey()]->removeArgument($arg);

            if ($this->mergeableArguments[$arg->getKey()]->isEmpty()) {
                unset($this->mergeableArguments[$arg->getKey()]);
            }
        } elseif ($arg instanceof IStackableArgument) {
            if (!isset($this->stackableArguments[$arg->getKey()])) {
                throw new \InvalidArgumentException("This argument doesn't exists");
            }
            $this->stackableArguments[$arg->getKey()]->removeArgument($arg);

            if ($this->stackableArguments[$arg->getKey()]->isEmpty()) {
                unset($this->stackableArguments[$arg->getKey()]);
            }
        } else {
            unset($this->arguments[$arg->getKey()]);
        }

        return $this;
    }
1164182
protected function _delete( $args, $assoc_args, $callback ) {
		$status = 0;

		if ( Utils\get_flag_value( $assoc_args, 'defer-term-counting' ) ) {
			wp_defer_term_counting( true );
		}

		foreach ( $args as $obj_id ) {
			$result = $callback( $obj_id, $assoc_args );
			$status = $this->success_or_failure( $result );
		}

		if ( Utils\get_flag_value( $assoc_args, 'defer-term-counting' ) ) {
			wp_defer_term_counting( false );
		}

		exit( $status );
	}
814147
public function preRemove(LifecycleEventArgs $args)
    {
        if ($args->getObject() instanceof MediaInterface) {
            $this->getProvider($args)->preRemove($args->getObject());
        }
    }
638543
public void deleteCalendar(GoogleCalendar calendar) throws IOException {
        dao.calendars().delete(calendar.getId()).execute();
    }
1084956
function calendarComponent() {
    $this->objName         = ( isset( $this->timezonetype )) ?
                          strtolower( $this->timezonetype )  :  get_class ( $this );
    $this->uid             = array();
    $this->dtstamp         = array();

    $this->action          = array();
    $this->attach          = array();
    $this->attendee        = array();
    $this->categories      = array();
    $this->class           = array();
    $this->comment         = array();
    $this->completed       = array();
    $this->contact         = array();
    $this->created         = array();
    $this->description     = array();
    $this->dtend           = array();
    $this->dtstart         = array();
    $this->due             = array();
    $this->duration        = array();
    $this->exdate          = array();
    $this->exrule          = array();
    $this->freebusy        = array();
    $this->geo             = array();
    $this->lastmodified    = array();
    $this->location        = array();
    $this->organizer       = array();
    $this->percentcomplete = array();
    $this->priority        = array();
    $this->rdate           = array();
    $this->recurrenceid    = array();
    $this->relatedto       = array();
    $this->repeat          = array();
    $this->requeststatus   = array();
    $this->resources       = array();
    $this->sequence        = array();
    $this->rrule           = array();
    $this->status          = array();
    $this->summary         = array();
    $this->transp          = array();
    $this->trigger         = array();
    $this->tzid            = array();
    $this->tzname          = array();
    $this->tzoffsetfrom    = array();
    $this->tzoffsetto      = array();
    $this->tzurl           = array();
    $this->url             = array();
    $this->xprop           = array();

    $this->components      = array();

    $this->language        = null;
    $this->nl              = null;
    $this->unique_id       = null;
    $this->allowEmpty      = TRUE;
    $this->xcaldecl        = array();

    $this->_makeDtstamp();
  }
1186132
public function preRemove(LifecycleEventArgs $args)
    {
        $entity = $args->getEntity();

        if ($entity instanceof Bug) {
            $this->messageBus->dispatch(new RemoveScreenshotsMessage($entity->getId(), $entity->getTask()->getModel()));
        }
    }
280729
public function handleDelete(Args $args)
    {
        $typeName = $args->getArgument('name');

        if (!$this->discoveryManager->hasRootTypeDescriptor($typeName)) {
            throw new RuntimeException(sprintf(
                'The type "%s" does not exist in the module "%s".',
                $typeName,
                $this->modules->getRootModuleName()
            ));
        }

        $this->discoveryManager->removeRootTypeDescriptor($typeName);

        return 0;
    }
210659
public static function SubstringAfter( $arg1, $arg2 )
	{
		$str = $arg1 instanceof Undefined
		    ? ""
		    : $arg1 . "";

		$substr = $arg2 instanceof Undefined
		    ? ""
		    : $arg2 . "";

	    if ( strlen( $str . $substr ) === 0 ) return "";

		$index = strpos( $str, $substr );
		return $index === false
			? ""
		    : substr( $str, $index + strlen( $substr ) );
	}
1319867
public function delete($resource, array $args = [], array $options = [])
    {
        $response = parent::delete($resource, $args, $options);
        $this->calls[] = [
            'method' => 'DELETE',
            'resource' => $resource,
            'args' => $args,
            'options' => $options,
            'success' => $response->success(),
            'response' => $response->getBody(),
        ];
        return $response;
    }