private function add($field, $args)
    {
        if ($this->hasField($field) && null !== $args[0]) {
            $this->virtualFieldsCollection[$field][] = $args[0];
        } else if ( null === $args[0]){
            throw new \InvalidArgumentException("The argument given is null ");
        } else {
            throw new \BadMethodCallException("There is no method add".ucfirst($field)."() on ".get_class($this));
        }
    }
private function add($field, $args)
    {
        if ($this->hasField($field) && null !== $args[0]) {
            $this->virtualFieldsCollection[$field][] = $args[0];
        } else if ( null === $args[0]){
            throw new \InvalidArgumentException("The argument given is null ");
        } else {
            throw new \BadMethodCallException("There is no method add".ucfirst($field)."() on ".get_class($this));
        }
    }
private function add ( $ field , $ args ) { if ( $ this -> hasField ( $ field ) && null !== $ args [ 0 ] ) { $ this -> virtualFieldsCollection [ $ field ] [ ] = $ args [ 0 ] ; } else if ( null === $ args [ 0 ] ) { throw new \ InvalidArgumentException ( "The argument given is null " ) ; } else { throw new \ BadMethodCallException ( "There is no method add" . ucfirst ( $ field ) . "() on " . get_class ( $ this ) ) ; } }
Add an object to a collection

@param string $field
@param array $args

@throws \BadMethodCallException
@throws \InvalidArgumentException
Add an object to a collection