HEX
Server: LiteSpeed
System: Linux s3.sitechai.com 4.18.0-553.51.1.lve.1.el8.x86_64 #1 SMP Wed May 14 14:34:57 UTC 2025 x86_64
User: workzeni (2217)
PHP: 8.1.32
Disabled: mail, show_source, system, shell_exec, passthru, exec, eval, shell
Upload Files
File: /home/workzeni/agency-erp-05.workzenix.com/vendor/pestphp/pest-plugin-arch/src/Layer.php
<?php

declare(strict_types=1);

namespace Pest\Arch;

use IteratorAggregate;
use PHPUnit\Architecture\Elements\Layer\Layer as BaseLayer;
use PHPUnit\Architecture\Elements\ObjectDescription;
use Traversable;

/**
 * @method Layer assertDoesNotDependOn(string ...$objects)
 * @method Layer excludeByNameStart(string $name)
 * @method Layer exclude(callable $callback)
 * @method Layer leaveByNameRegex(string $name)
 * @method Layer leaveByNameStart(string $name)
 *
 * @implements IteratorAggregate<int, ObjectDescription>
 */
final class Layer implements IteratorAggregate
{
    /**
     * Creates a new layer instance.
     */
    private function __construct(private readonly BaseLayer $layer)
    {
        //
    }

    /**
     * Creates a new layer instance from the given base layer.
     *
     * @param  array<int, ObjectDescription>  $objects
     */
    public static function fromBase(array $objects): self
    {
        return new self(new BaseLayer($objects));
    }

    /**
     * If the layer is equal to the given layer.
     */
    public function equals(self $layer): bool
    {
        return $this->layer->equals($layer->layer);
    }

    /**
     * Get the iterator.
     */
    public function getIterator(): Traversable
    {
        return $this->layer->getIterator();
    }

    /**
     * Get the base layer.
     */
    public function getBase(): BaseLayer
    {
        return $this->layer;
    }

    /**
     * Dynamically calls the layer methods.
     *
     * @param  array<int, mixed>  $arguments
     */
    public function __call(string $name, array $arguments): self
    {
        return new self($this->layer->{$name}(...$arguments)); // @phpstan-ignore-line
    }
}