<commit_before><?php

declare (strict_types = 1);

namespace Mihaeu\PhpDependencies;

class ClazzDependencies implements \Countable
{
    /** @var Clazz */
    private $clazz;

    /** @var Clazz[] */
    private $dependencies = [];

    /**
     * @param Clazz $clazz
     */
    public function __construct(Clazz $clazz = null)
    {
        $this->clazz = $clazz;
    }

    public function addDependency(Clazz $clazz)
    {
        if (!in_array($clazz, $this->dependencies, true)) {
            $this->dependencies[] = $clazz;
        }
    }

    /**
     * @return Clazz
     */
    public function clazz() : Clazz
    {
        return $this->clazz;
    }

    /**
     * @return Clazz[]
     */
    public function dependencies() : array
    {
        return $this->dependencies;
    }

    /**
     * Count elements of an object.<commit_msg>Remove duplicate dependencies<commit_after><?php

declare (strict_types = 1);

namespace Mihaeu\PhpDependencies;

class ClazzDependencies implements \Countable
{
    /** @var Clazz */
    private $clazz;

    /** @var Clazz[] */
    private $dependencies = [];

    /**
     * @param Clazz $clazz
     */
    public function __construct(Clazz $clazz = null)
    {
        $this->clazz = $clazz;
    }

    public function addDependency(Clazz $clazz)
    {
        if (!in_array($clazz, $this->dependencies)) {
            $this->dependencies[] = $clazz;
        }
    }

    /**
     * @return Clazz
     */
    public function clazz() : Clazz
    {
        return $this->clazz;
    }

    /**
     * @return Clazz[]
     */
    public function dependencies() : array
    {
        return $this->dependencies;
    }

    /**
     * Count elements of an object.
{'fraction_non_alphanumeric': 0.13859649122807016, 'fraction_numerical': 0.0011695906432748538, 'mean_word_length': 1.9704861111111112, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5254529', 'n_tokens_mistral': 550, 'n_tokens_neox': 523, 'n_words': 118}