chevere/chevere

View on GitHub
src/Dependent/Interfaces/DependenciesInterface.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

/*
 * This file is part of Chevere.
 *
 * (c) Rodolfo Berrios <rodolfo@chevere.org>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Chevere\Dependent\Interfaces;

use Chevere\DataStructure\Interfaces\MappedInterface;
use Chevere\Throwable\Exceptions\OutOfBoundsException;
use Iterator;

/**
 * Describes the component in charge of defining dependencies.
 */
interface DependenciesInterface extends MappedInterface
{
    public function __construct(string ...$dependencies);

    public function withPut(string ...$dependencies): self;

    public function withMerge(self $dependencies): self;

    /**
     * Indicates whether the instance declares a dependency for the given key.
     */
    public function hasKey(string $key): bool;

    /**
     * Provides access to the dependency class name.
     *
     * @throws OutOfBoundsException
     */
    public function key(string $key): string;

    /**
     * @return Iterator<string, string> Name to dependency class name
     */
    public function getIterator(): Iterator;
}