Adds a new member to the collection

@param mixed $object
@param null|string|int $key

@throws CollectionException
199117
public function addItem($object, ?string $key = null) : void
    {
        $this->checkCallback();

        if (null !== $key) {
            if (isset($this->members[$key])) {
                throw new CollectionException('Unable to add to collection - key ' . $key . ' already used.');
            } else {
                $this->members[$key] = $object;
            }
        } else {
            $this->members[] = $object;
        }
    }
274252
public static function getFromObject($object, string $key)
    {
        if ($object == null) {
            return null;
        }
        if (!isset ($object->{$key})) {
            return null;
        }
        return $object->{$key};
    }
819536
public function attach($object)
    {
        $this->checkType($object);

        if (gettype($object) !== 'object') {
            $msg = "You can only attach 'objects' into an AbstractCollection, '" . gettype($object) . "' given";
            throw new InvalidArgumentException($msg);
        } elseif (!$this->contains($object)) {
            $this->offsetSet(null, $object);
        }
    }
908283
public void addObject(E object){
		if(stopped==true){
			log.warn("Adding a new object ignored, the pool is stopped");
			return ;
		}

		// add to the end
		objectList.add(object);
//		if (log.isDebugEnabled()){
//			log.debug("ADD, size:'"+objectListSize()+"' "+object.hashCode()+" stopped:"+stopedThreadNumber+" "+object.toString());
//		}

		// Waits for an stoped worked before returning !!!!
		// except if this thread is a thread of the pool 
		if (!objectList.isEmpty() && stopedThreadNumber==0 && !threadMap.containsKey(Thread.currentThread().getName())){
			synchronized (threadList) {
				try {
					threadList.wait();
				} catch (InterruptedException e) {
					
				}
			}
		}
		
		synchronized (objectList) {
			objectList.notify();
		}
	}
125946
public
    function add(
        $value = null,
        $key = ''
    ) {
        //var_dump($this->type);
        //var_dump($value);
        //var_dump(is_object($value));
        //die;

        if ($this->isClass) {
            //echo "  isClass".PHP_EOL;
            if (!is_a($value, $this->type)) {
                //throw new TypeCheckException('Object type "'.get_class($value).'" is not of type "'.$this->type.'".');
                $type = is_object($value) ? get_class($value) : gettype($value);
                throw new TypeCheckException('Object type "'.$type.'" is not of type "'.$this->type.'".');
            } else {
                // add to collection
                if ($key != '') {
                    if (array_key_exists($key, $this->collection)) {
                        throw new ArgumentException(
                            'Can not add object to key "'.$key.'", because key already exists.'
                        );
                    } else {
                        $this->collection[$key] = $value;
                    }
                } else {
                    array_push($this->collection, $value);
                }
            }
        } else {
            //echo "  noClass".PHP_EOL;
            if ($this->type == gettype($value)) {
                // add to collection
                if ($key != '') {
                    if (array_key_exists($key, $this->collection)) {
                        throw new ArgumentException('Can not add value to key "'.$key.'", because key already exists.');
                    } else {
                        $this->collection[$key] = $value;
                    }
                } else {
                    array_push($this->collection, $value);
                }
            } else {
                throw new TypeCheckException('Value type "'.gettype($value).'" is not of type "'.$this->type.'".');
            }
        }
    }
103394
function addMembers(list, obj) {
		var keys = Object.keys(obj || {});

		for (var i = 0; i < keys.length; i++) {
			list.push({
				owner: obj,
				key: keys[i],
				value: obj[keys[i]]
			});
		}
	}
1321560
public void put(DBObject key, Object object) {
        //noinspection unchecked
        objectCache.put(flatten(key.toMap()), new WeakReference(object));
    }
627777
public function addExtension($key, $class)
    {
        $extension = new ExtensionCollection($key, $class);

        foreach ($extension->collection() as $obj_type => $collection) {
            foreach ($collection as $obj_key => $obj_class) {
                $this->{$obj_type}->addExtension($obj_key, $obj_class);
            }
        }
    }
1084436
public function get($object, $key, $cache=null)
    {
        $query = $this->query(
            "{$this->foreign}=?", $object->get($this->local));

        return new Collection($this->class, $query, $this->adder($object));
    }
1348885
public static function bind($key, $object = null)
    {
        if(is_array($key))
        {
            foreach($key as $key => $object)
            {
                self::$bindings[$key] = $object;
            }
        }
        else
        {
            self::$bindings[$key] = $object;
        }
    }
262608
public function addObject( $object )
	{
		if( !is_object( $object ) )
			throw new InvalidArgumentException( 'Not an object given' );
		$reflection	= new ReflectionObject( $object );
		$methods	= $reflection->getMethods();
		foreach( $methods as $method )
		{
			if( in_array( $method->name, $this->delegableMethods ) )
				throw new RuntimeException( 'Method "'.$method->name.'" is already set' );
			$this->delegableMethods[]	= $method->name;
		}
		$this->delegableObjects[]	= $object;
	}
958862
public function add($object)
    {
        $this->hasUnpersistedChanges = true;
        $this->addedObjects->attach($object);
        $this->removedObjects->detach($object);
    }
54884
public void add(String key, Object object) {
    int fieldIndex = getIndex(key);
    if (object.getClass() == ParquetGroup.class) {
      this.addGroup(key, (Group) object);
    } else {
      this.add(fieldIndex, (Primitive) object);
    }
  }
846710
public function add($objects)
    {
        if (!is_array($objects))
        {
            $objects = [$objects];
        }
        $operation = new AVRelationOperation($objects, null);
        $this->targetClassName = $operation->_getTargetClass();
        $this->parent->_performOperation($this->key, $operation);
    }
266503
public static function set($object, $key = null) {
        if (!is_object($object)) {
            throw new InvalidObjectException('The object to register must be instantiated');
        }

        if (!$key) {
            $key = get_class($object);
        }

        static::$_registered[$key] = $object;

        return $object;
    }
546957
protected function doAdd($object)
    {
        $this->notifyAccess();
        $this->objectsArray[$this->total] = $object;
        $this->total++;
    }
282130
public function add($object)
    {
        if ($this->removedNodes->contains($object)) {
            $this->removedNodes->detach($object);
        }
        if (!$this->addedNodes->contains($object)) {
            $this->addedNodes->attach($object);
        }
        parent::add($object);
    }