public function setGroups(array $groups)
    {
        foreach ($groups as $groupIdent => $groupStruct) {
            if (!is_array($groupStruct)) {
                throw new InvalidArgumentException(sprintf(
                    'The attachment group "%s" must be an array of attachable objects',
                    $groupIdent
                ));
            }

            if (isset($groupStruct['ident'])) {
                $groupIdent = $groupStruct['ident'];
                unset($groupStruct['ident']);
            }

            if (!is_string($groupIdent)) {
                throw new InvalidArgumentException(
                    'The attachment group identifier must be a string'
                );
            }

            if (isset($groupStruct['attachable_objects'])) {
                $groupStruct = $groupStruct['attachable_objects'];
            } elseif (isset($groupStruct['attachables'])) {
                $groupStruct = $groupStruct['attachables'];
            }

            $this->groups[$groupIdent] = $groupStruct;
        }

        return $this;
    }
public function setGroups(array $groups)
    {
        foreach ($groups as $groupIdent => $groupStruct) {
            if (!is_array($groupStruct)) {
                throw new InvalidArgumentException(sprintf(
                    'The attachment group "%s" must be an array of attachable objects',
                    $groupIdent
                ));
            }

            if (isset($groupStruct['ident'])) {
                $groupIdent = $groupStruct['ident'];
                unset($groupStruct['ident']);
            }

            if (!is_string($groupIdent)) {
                throw new InvalidArgumentException(
                    'The attachment group identifier must be a string'
                );
            }

            if (isset($groupStruct['attachable_objects'])) {
                $groupStruct = $groupStruct['attachable_objects'];
            } elseif (isset($groupStruct['attachables'])) {
                $groupStruct = $groupStruct['attachables'];
            }

            $this->groups[$groupIdent] = $groupStruct;
        }

        return $this;
    }
public function setGroups ( array $ groups ) { foreach ( $ groups as $ groupIdent => $ groupStruct ) { if ( ! is_array ( $ groupStruct ) ) { throw new InvalidArgumentException ( sprintf ( 'The attachment group "%s" must be an array of attachable objects' , $ groupIdent ) ) ; } if ( isset ( $ groupStruct [ 'ident' ] ) ) { $ groupIdent = $ groupStruct [ 'ident' ] ; unset ( $ groupStruct [ 'ident' ] ) ; } if ( ! is_string ( $ groupIdent ) ) { throw new InvalidArgumentException ( 'The attachment group identifier must be a string' ) ; } if ( isset ( $ groupStruct [ 'attachable_objects' ] ) ) { $ groupStruct = $ groupStruct [ 'attachable_objects' ] ; } elseif ( isset ( $ groupStruct [ 'attachables' ] ) ) { $ groupStruct = $ groupStruct [ 'attachables' ] ; } $ this -> groups [ $ groupIdent ] = $ groupStruct ; } return $ this ; }
Set attachment type groups.

@param  array $groups One or more groupings.
@throws InvalidArgumentException If the group identifier or structure is invalid.
@return AttachmentsConfig Chainable
Set attachment type groups .