<?php

namespace Lc\CaracoleBundle\Solver\Product;

use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilySectionPropertyInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface;

class ProductFamilySectionPropertySolver
{

    public function getProductFamilySectionProperty(ProductFamilyInterface $productFamily, SectionInterface $section):? ProductFamilySectionPropertyInterface
    {
        foreach ($productFamily->getProductFamilySectionProperties() as $productFamilySectionProperty) {
            if ($productFamilySectionProperty->getSection() == $section) {
                return $productFamilySectionProperty;
            }
        }
        return null;
    }
}