<commit_before><?hh // strict
/**
 * @author <NAME> <<EMAIL>>
 * Date: 2/9/15
 * Time: 5:14 PM
 */

namespace Titon\Context\Definition;

use Titon\Context\Depository;

abstract class Definition
{
    protected string $alias;
    protected Depository $depository;
    protected Vector<mixed> $arguments = Vector{};

    public function __construct(string $alias, Depository $depository) {}

    public function with(...$arguments): this
    {
        foreach ($arguments as $argument) {
            $this->arguments[] = $argument;
        }

        return $this;
    }

    abstract public function create(...$arguments);

    public function resolveArguments()
    {
        $resolvedArguments = [];

        foreach ($this->arguments as $argument) {
            if (is_string($argument)) {
                $resolvedArguments[] = $this->depository->make($argument);
                continue;
            }

            $resolvedArguments[] = $argument;
        }

        return $resolvedArguments;
    }
}<commit_msg>fixed constructor, fixed bug in resolving arguments that weren't actually classes (argument values)<commit_after><?hh // strict
/**
 * @author <NAME> <<EMAIL>>
 * Date: 2/9/15
 * Time: 5:14 PM
 */

namespace Titon\Context\Definition;

use Titon\Context\Depository;

abstract class Definition
{
    protected string $alias;

    protected Depository $depository;

    protected array $arguments = [];

    public function __construct(string $alias, Depository $depository)
    {
        $this->alias = $alias;
        $this->depository = $depository;
    }

    public function with(...$arguments): this
    {
        foreach ($arguments as $argument) {
            $this->arguments[] = $argument;
        }

        return $this;
    }

    abstract public function create(...$arguments);

    public function resolveArguments(...$arguments)
    {
        if ($arguments) {
            $this->arguments = $arguments;
        }

        $resolvedArguments = [];

        foreach ($this->arguments as $argument) {
            if (is_string($argument) && (isset($this->depository[$argument]) || class_exists($argument))) {
                $resolvedArguments[] = $this->depository[$argument];
                continue;
            }

            $resolvedArguments[] = $argument;
        }

        return $resolvedArguments;
    }
}
{'fraction_non_alphanumeric': 0.1303236797274276, 'fraction_numerical': 0.00596252129471891, 'mean_word_length': 2.3461538461538463, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 21, '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': '6804426', 'n_tokens_mistral': 643, 'n_tokens_neox': 607, 'n_words': 153}