src/Charcoal/Model/Collection.php
public function add($obj)
    {
        if (!$this->isAcceptable($obj)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Must be a model, received %s',
                    (is_object($obj) ? get_class($obj) : gettype($obj))
                )
            );
        }

        $key = $this->modelKey($obj);
        $this->objects[$key] = $obj;

        return $this;
    }
public function add($obj)
    {
        if (!$this->isAcceptable($obj)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Must be a model, received %s',
                    (is_object($obj) ? get_class($obj) : gettype($obj))
                )
            );
        }

        $key = $this->modelKey($obj);
        $this->objects[$key] = $obj;

        return $this;
    }
public function add ( $ obj ) { if ( ! $ this -> isAcceptable ( $ obj ) ) { throw new InvalidArgumentException ( sprintf ( 'Must be a model, received %s' , ( is_object ( $ obj ) ? get_class ( $ obj ) : gettype ( $ obj ) ) ) ) ; } $ key = $ this -> modelKey ( $ obj ) ; $ this -> objects [ $ key ] = $ obj ; return $ this ; }
Add an object to the collection.

@param  object $obj An acceptable object.
@throws InvalidArgumentException If the given object is not acceptable.
@return self
Add an object to the collection .