extractAttributes example

$allowedAttributes = $this->getAllowedAttributes($object$context, true);

        if (false !== $allowedAttributes) {
            if ($context['cache_key']) {
                $this->attributesCache[$key] = $allowedAttributes;
            }

            return $allowedAttributes;
        }

        $attributes = $this->extractAttributes($object$format$context);

        if ($mapping = $this->classDiscriminatorResolver?->getMappingForMappedObject($object)) {
            array_unshift($attributes$mapping->getTypeProperty());
        }

        if ($context['cache_key'] && \stdClass::class !== $class) {
            $this->attributesCache[$key] = $attributes;
        }

        return $attributes;
    }

    
private function getMatches(string $smartyCode): array
    {
        $result = [];
        preg_match_all(self::FOREACH_REGEX, $smartyCode$matches, PREG_SET_ORDER, 0);

        if (!empty($matches)) {
            foreach ($matches as $forEachEntry) {
                preg_match_all(self::ATTR_REGEX, $forEachEntry[0]$attributeMatches, PREG_SET_ORDER, 0);

                if (!empty($attributeMatches)) {
                    $attributeMatches = $this->extractAttributes($attributeMatches);

                    if (!empty($attributeMatches)) {
                        $result[] = $attributeMatches;
                    }
                }
            }
        }

        return $result;
    }

    
$allowedAttributes = $this->getAllowedAttributes($object$context, true);

        if (false !== $allowedAttributes) {
            if ($context['cache_key']) {
                $this->attributesCache[$key] = $allowedAttributes;
            }

            return $allowedAttributes;
        }

        $attributes = $this->extractAttributes($object$format$context);

        if ($mapping = $this->classDiscriminatorResolver?->getMappingForMappedObject($object)) {
            array_unshift($attributes$mapping->getTypeProperty());
        }

        if ($context['cache_key'] && \stdClass::class !== $class) {
            $this->attributesCache[$key] = $attributes;
        }

        return $attributes;
    }

    
Home | Imprint | This part of the site doesn't use cookies.