<commit_before><?php

namespace SpeckCatalog\Model\Product;

use SpeckCatalog\Model\AbstractModel;
use SpeckCatalog\Model\Product as Base;

class Relational extends Base
{
    protected $parent;
    protected $manufacturer;
    protected $options;
    protected $uoms;
    protected $images;
    protected $specs;
    protected $documents;
    protected $features;
    protected $builders;

    public function getKey()
    {
        return $this->productId;
    }

    public function getRecursivePrice()
    {
        $price = $this->getPrice();

        $adjustmentPrice = 0;
        if ($this->has('options')) {
            foreach ($this->getOptions() as $option) {
                $adjustmentPrice += $option->getRecursivePrice($price);
            }
        }

        return $price + $adjustmentPrice;
    }

    public function getPrice()
    {
        if ($this->has('uoms')) {
            $uomPrices = array();
            foreach($this->getUoms() as $uom) {
                $uomPrices[] = $uom->getPrice();
            }
            asort($uomPrices, SORT_NUMERIC);
            return array_shift($uomPrices);
        }
        if ($this->has('builders')) {
            foreach ($this->getBuilders() as $builder) {
                //get lowest price builder
            }
        }
        return 0;
    }

    public function getImage()
    {
        if (isset($this->images[0])) {
            return $this->images[0];<commit_msg>add extra logic to getPrice method on products for products that do not have uoms, but instead have builder products with uoms.<commit_after><?php

namespace SpeckCatalog\Model\Product;

use SpeckCatalog\Model\AbstractModel;
use SpeckCatalog\Model\Product as Base;

class Relational extends Base
{
    protected $parent;
    protected $manufacturer;
    protected $options;
    protected $uoms;
    protected $images;
    protected $specs;
    protected $documents;
    protected $features;
    protected $builders;

    public function getKey()
    {
        return $this->productId;
    }

    public function getRecursivePrice()
    {
        $price = $this->getPrice();

        $adjustmentPrice = 0;
        if ($this->has('options')) {
            foreach ($this->getOptions() as $option) {
                $adjustmentPrice += $option->getRecursivePrice($price);
            }
        }

        return $price + $adjustmentPrice;
    }

    public function getPrice()
    {
        if ($this->has('uoms')) {
            $uomPrices = array();
            foreach($this->getUoms() as $uom) {
                $uomPrices[] = $uom->getPrice();
            }
            asort($uomPrices, SORT_NUMERIC);
            return array_shift($uomPrices);
        } elseif ($this->has('builders')) {
            $uomPrices = array();
            foreach ($this->getBuilders() as $builder) {
                foreach($builder->getProduct()->getUoms() as $uom) {
                    $uomPrices[] = $uom->getPrice();
                }
            }
            asort($uomPrices, SORT_NUMERIC);
            return array_shift($uomPrices);
        }
        return 0;
    }

    public function getImage()
    {
        if (isset($this->images[0])) {
            return $this->images[0];
{'fraction_non_alphanumeric': 0.1256218905472637, 'fraction_numerical': 0.0024875621890547263, 'mean_word_length': 1.9925581395348837, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5891466', 'n_tokens_mistral': 937, 'n_tokens_neox': 920, 'n_words': 205}