<?php
declare(strict_types=1);

namespace App\Framework\View;

use App\Framework\Core\AttributeMapper;
use ReflectionMethod;

final class TemplateMapper implements AttributeMapper
{
    public function getAttributeClass(): string
    {
        return Template::class;
    }

    public function map(object $reflectionTarget, object $attributeInstance): ?array
    {
        if (!$attributeInstance instanceof Template) {
            return null;
        }

        return [
            'class' => $reflectionTarget->getName(),
            #'method' => $reflectionTarget->getName(),
            'path' => $attributeInstance->path,
        ];
    }
}
