public function phpTypecastComposite($value)
    {
        if (is_string($value)) {
            $value = $this->getCompositeParser()->parse($value);
        }
        if (is_array($value)) {
            $result = [];
            $fields = array_keys($this->columns);
            foreach ($value as $i => $item) {
                $field = is_int($i) ? $fields[$i] : $i;
                if (isset($this->columns[$field])) {
                    $result[$field] = $this->columns[$field]->phpTypecast($item);
                }
            }

            return $this->createCompositeObject($result);
        } elseif (!$value instanceof $this->phpType) {
            return null;
        }

        return $value;
    }
public function phpTypecastComposite($value)
    {
        if (is_string($value)) {
            $value = $this->getCompositeParser()->parse($value);
        }
        if (is_array($value)) {
            $result = [];
            $fields = array_keys($this->columns);
            foreach ($value as $i => $item) {
                $field = is_int($i) ? $fields[$i] : $i;
                if (isset($this->columns[$field])) {
                    $result[$field] = $this->columns[$field]->phpTypecast($item);
                }
            }

            return $this->createCompositeObject($result);
        } elseif (!$value instanceof $this->phpType) {
            return null;
        }

        return $value;
    }
public function phpTypecastComposite ( $ value ) { if ( is_string ( $ value ) ) { $ value = $ this -> getCompositeParser ( ) -> parse ( $ value ) ; } if ( is_array ( $ value ) ) { $ result = [ ] ; $ fields = array_keys ( $ this -> columns ) ; foreach ( $ value as $ i => $ item ) { $ field = is_int ( $ i ) ? $ fields [ $ i ] : $ i ; if ( isset ( $ this -> columns [ $ field ] ) ) { $ result [ $ field ] = $ this -> columns [ $ field ] -> phpTypecast ( $ item ) ; } } return $ this -> createCompositeObject ( $ result ) ; } elseif ( ! $ value instanceof $ this -> phpType ) { return null ; } return $ value ; }
Converts the composite type to PHP
@param array|string|object|null $value the value to be converted
@return array|object|null Composite object as described in `ColumnSchema::$phpType` (@see `Schema::$compositeMap`) or `null`
Converts the composite type to PHP