Removes an object from the set

All numerical array keys will be modified to start counting from zero while literal keys won't be touched.

@param   KObjectHandlable $object
@return  KObjectSet
484444
public function remove(KObjectHandlable $object)
    {
        if ($this->offsetExists($object)) {
            $this->offsetUnset($object);
        }

        return $this;
    }
1175513
public function contains(KObjectHandlable $object)
    {
        $result = false;

        if($handle = $object->getHandle()) {
            $result = $this->__object_list->offsetExists($handle);
        }

        return $result;
    }
653378
public function remove($object, $flush = true)
    {
        $this->isExpectedObject($object);
        $this->objectManager->remove($object);
        if ($flush) {
            $this->flush();
        }
    }
117436
public static function toObject(array $array, $object)
    {
        $class = get_class($object);

        $methods = get_class_methods($class);

        foreach ($methods as $method) {

            preg_match(' /^(set)(.*?)$/i', $method, $results);

            $pre = $results[1] ?? '';

            $k = $results[2] ?? '';

            $k = strtolower(substr($k, 0, 1)) . substr($k, 1);

            if ($pre == 'set' && !empty($array[$k])) {

                $object->$method($array[$k]);
            }
        }
        return $object;
    }
366106
public static function toSimpleArray( $object )
    {
        if ( is_object( $object ) )
        {
            $object = (array)$object;
        }

        if ( !is_array( $object ) )
        {
            return $object;
        }

        $_result = array();

        foreach ( $object as $_key => $_value )
        {
            $_result[preg_replace( "/^\\0(.*)\\0/", "", $_key )] = self::toSimpleArray( $_value );
        }

        return $_result;
    }
354501
private function convertDateKeysInObjects($object)
	{
		// only hanlde objects
		if (!is_object($object))
		{
			return $object;
		}

		// spin over each key replacing the date with new format
		foreach (array_keys(get_object_vars($object)) as $key)
		{
			if (in_array($key, $this->dateKeys))
			{
				$object->$key = with(new Date($object->$key))->format('Y-m-d\TH:i:s\Z');
			}
		}

		// return object
		return $object;
	}
713476
public static function reset($object)
	{
		if (!($object instanceof EnumValueDescriptorProto)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\EnumValueDescriptorProto.');
		}
		$object->name = NULL;
		$object->number = NULL;
		$object->options = NULL;
	}
218242
public function fromArray(array $object = array())
    {
        if (count($object) > 0) {
            $reflector = new \ReflectionClass($this);
            $properties = InjectorHelper::extractProperties($reflector, \ReflectionProperty::IS_PUBLIC, InjectorHelper::VAR_PATTERN);
            unset($reflector);
            foreach ($object as $key => $value) {
                if (property_exists($this, $key) && null !== $value) {
                    $this->parseDtoField($properties, $key, $value);
                }
            }
        }
    }
1084014
public static function reset($object)
	{
		if (!($object instanceof MethodOptions)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\MethodOptions.');
		}
		$object->deprecated = NULL;
		$object->uninterpretedOption = NULL;
	}
363320
public function insert(KObjectHandlable $object)
    {
        $result = false;

        if ($handle = $object->getHandle())
        {
            $this->offsetSet($object, null);
            $result = true;
        }

        return $result;
    }
535942
public function offsetGet($object)
    {
        if (!$object instanceof AnObjectHandlable) {
            throw new InvalidArgumentException('Object needs to implement AnObjectHandlable');
        }

        return $this->_object_set->offsetGet($object->getHandle());
    }
989879
public static function reset($object)
	{
		if (!($object instanceof FileOptions)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\FileOptions.');
		}
		$object->javaPackage = NULL;
		$object->javaOuterClassname = NULL;
		$object->javaMultipleFiles = NULL;
		$object->javaGenerateEqualsAndHash = NULL;
		$object->javaStringCheckUtf8 = NULL;
		$object->optimizeFor = NULL;
		$object->goPackage = NULL;
		$object->ccGenericServices = NULL;
		$object->javaGenericServices = NULL;
		$object->pyGenericServices = NULL;
		$object->deprecated = NULL;
		$object->ccEnableArenas = NULL;
		$object->objcClassPrefix = NULL;
		$object->csharpNamespace = NULL;
		$object->javananoUseDeprecatedPackage = NULL;
		$object->uninterpretedOption = NULL;
	}
110526
public function removeObject($object)
    {
        $oid = spl_object_hash($object);
        $data = [];
        if (isset($this->objectsRepository[$oid])) {
            $repository = $this->objectsRepository[$oid];
            $data = $repository->getHydrator()->unhydrate($object);
        }
        $id = isset($data['_id']) ? serialize($data['_id']) . $repository->getCollection() : $oid;

        if (!isset($this->objectStates[$id])) {
            throw new Exception\StateException("Can't remove object, it does not be managed");
        }

        unset($this->objectStates[$id]);
        unset($this->objects[$id]);
        unset($this->objectsRepository[$id]);
        unset($this->objectStates[$oid]);
        unset($this->objects[$oid]);
        unset($this->objectsRepository[$oid]);
    }
605297
public function dequeue( KObjectHandlable $object)
    {
        $result = false;

        if($handle = $object->getHandle())
        {
            if($this->__object_list->offsetExists($handle))
            {
                $this->__object_list->offsetUnset($handle);
                $this->__priority_list->offsetUnSet($handle);

                if($object instanceof KObjectInterface) {
                    unset($this->__identifier_list[$handle]);
                }

                $result = true;
            }
        }

        return $result;
    }
387270
public static function reset($object)
	{
		if (!($object instanceof ServiceDescriptorProto)) {
			throw new \InvalidArgumentException('You have to pass object of class Google\Protobuf\ServiceDescriptorProto.');
		}
		$object->name = NULL;
		$object->method = NULL;
		$object->options = NULL;
	}
1192585
protected function resetObject(&$object)
    {
        $class = new \ReflectionClass($this->className);
        $properties = $class->getDefaultProperties();

        foreach ($properties as $propName => $property) {
            if (is_string($property) && class_exists($property)) {
                $object->with(null, $propName);
            }
        }
    }
1061232
public function objectDestroy($object)
    {
        if (!$object) {
            $this->setError('Not a valid object');
            return false;
        }

        // --------------------------------------------------------------------------

        $object = $this->getObject($object);

        if ($object) {
            if (!$this->objectDelete($object->id)) {
                return false;
            }
        }

        //  Object doesn't exist but may exist in the trash
        $object = $this->getObjectFromTrash($object);

        if (!$object) {
            $this->setError('Nothing to destroy.');
            return false;
        }

        // --------------------------------------------------------------------------

        //  Attempt to remove the file
        if ($this->callDriver('objectDestroy', [$object->file->name->disk, $object->bucket->slug])) {

            //  Remove the database entries
            $oDb = Factory::service('Database');
            $oDb->trans_begin();

            $oDb->where('id', $object->id);
            $oDb->delete(NAILS_DB_PREFIX . 'cdn_object');

            $oDb->where('id', $object->id);
            $oDb->delete(NAILS_DB_PREFIX . 'cdn_object_trash');

            if ($oDb->trans_status() === false) {

                $oDb->trans_rollback();
                return false;

            } else {

                $oDb->trans_commit();
                $this->unsetCacheObject($object);
                return true;
            }
        } else {

            $this->setError($this->callDriver('lastError'));
            return false;
        }
    }