src/Charcoal/Property/ModelStructureProperty.php
public function setStructureMetadata($data)
    {
        if ($data === null) {
            $this->structureMetadata = $data;
            $this->terminalStructureMetadata = $data;
        } elseif (is_array($data)) {
            $struct = $this->createStructureMetadata();
            $struct->merge($data);

            $this->structureMetadata = $struct;
            $this->terminalStructureMetadata = $data;
        } elseif ($data instanceof MetadataInterface) {
            $this->structureMetadata = $data;
            $this->terminalStructureMetadata = $data;
        } else {
            throw new InvalidArgumentException(sprintf(
                'Structure [%s] is invalid (must be array or an instance of %s).',
                (is_object($data) ? get_class($data) : gettype($data)),
                StructureMetadata::class
            ));
        }

        $this->isStructureFinalized = false;

        return $this;
    }
public function setStructureMetadata($data)
    {
        if ($data === null) {
            $this->structureMetadata = $data;
            $this->terminalStructureMetadata = $data;
        } elseif (is_array($data)) {
            $struct = $this->createStructureMetadata();
            $struct->merge($data);

            $this->structureMetadata = $struct;
            $this->terminalStructureMetadata = $data;
        } elseif ($data instanceof MetadataInterface) {
            $this->structureMetadata = $data;
            $this->terminalStructureMetadata = $data;
        } else {
            throw new InvalidArgumentException(sprintf(
                'Structure [%s] is invalid (must be array or an instance of %s).',
                (is_object($data) ? get_class($data) : gettype($data)),
                StructureMetadata::class
            ));
        }

        $this->isStructureFinalized = false;

        return $this;
    }
public function setStructureMetadata ( $ data ) { if ( $ data === null ) { $ this -> structureMetadata = $ data ; $ this -> terminalStructureMetadata = $ data ; } elseif ( is_array ( $ data ) ) { $ struct = $ this -> createStructureMetadata ( ) ; $ struct -> merge ( $ data ) ; $ this -> structureMetadata = $ struct ; $ this -> terminalStructureMetadata = $ data ; } elseif ( $ data instanceof MetadataInterface ) { $ this -> structureMetadata = $ data ; $ this -> terminalStructureMetadata = $ data ; } else { throw new InvalidArgumentException ( sprintf ( 'Structure [%s] is invalid (must be array or an instance of %s).' , ( is_object ( $ data ) ? get_class ( $ data ) : gettype ( $ data ) ) , StructureMetadata :: class ) ) ; } $ this -> isStructureFinalized = false ; return $ this ; }
Set the property's structure.

@param  MetadataInterface|array|null $data The property's structure (fields, data).
@throws InvalidArgumentException If the structure is invalid.
@return self
Set the property s structure .