src/WithArrayTransform.php
public function getFieldsConfig()
    {
        if (null === $this->fieldsConfigList) {
            $this->fieldsConfigList = [];

            foreach ($this->getFields() as $field) {
                $reflectionProperty = $this->getReflector()->getProperty($field);
                $docBlock = $reflectionProperty->getDocComment();
                preg_match('/@var\s([a-z]*).*/', $docBlock, $matches);

                $this->fieldsConfigList[$field] = [
                    'type' => isset($matches[1]) ? $matches[1] : null
                ];
            }

        }

        return $this->fieldsConfigList;
    }
public function getFieldsConfig()
    {
        if (null === $this->fieldsConfigList) {
            $this->fieldsConfigList = [];

            foreach ($this->getFields() as $field) {
                $reflectionProperty = $this->getReflector()->getProperty($field);
                $docBlock = $reflectionProperty->getDocComment();
                preg_match('/@var\s([a-z]*).*/', $docBlock, $matches);

                $this->fieldsConfigList[$field] = [
                    'type' => isset($matches[1]) ? $matches[1] : null
                ];
            }

        }

        return $this->fieldsConfigList;
    }
public function getFieldsConfig ( ) { if ( null === $ this -> fieldsConfigList ) { $ this -> fieldsConfigList = [ ] ; foreach ( $ this -> getFields ( ) as $ field ) { $ reflectionProperty = $ this -> getReflector ( ) -> getProperty ( $ field ) ; $ docBlock = $ reflectionProperty -> getDocComment ( ) ; preg_match ( '/@var\s([a-z]*).*/' , $ docBlock , $ matches ) ; $ this -> fieldsConfigList [ $ field ] = [ 'type' => isset ( $ matches [ 1 ] ) ? $ matches [ 1 ] : null ] ; } } return $ this -> fieldsConfigList ; }
Fetch the var metadata for a field and store it in the config.
@return array
Fetch the var metadata for a field and store it in the config .