PHP 8.2.31
Preview: InflectorAggregate.php Size: 1.23 KB
/var/softaculous/sitepad/editor/site-data/plugins/kkart-pro/vendor/league/container/src/Inflector/InflectorAggregate.php

<?php declare(strict_types=1);

namespace Automattic\Kkart\Vendor\League\Container\Inflector;

use Generator;
use Automattic\Kkart\Vendor\League\Container\ContainerAwareTrait;

class InflectorAggregate implements InflectorAggregateInterface
{
    use ContainerAwareTrait;

    /**
     * @var Inflector[]
     */
    protected $inflectors = [];

    /**
     * {@inheritdoc}
     */
    public function add(string $type, callable $callback = null) : Inflector
    {
        $inflector          = new Inflector($type, $callback);
        $this->inflectors[] = $inflector;

        return $inflector;
    }

    /**
     * {@inheritdoc}
     */
    public function getIterator() : Generator
    {
        $count = count($this->inflectors);

        for ($i = 0; $i < $count; $i++) {
            yield $this->inflectors[$i];
        }
    }

    /**
     * {@inheritdoc}
     */
    public function inflect($object)
    {
        foreach ($this->getIterator() as $inflector) {
            $type = $inflector->getType();

            if (! $object instanceof $type) {
                continue;
            }

            $inflector->setLeagueContainer($this->getLeagueContainer());
            $inflector->inflect($object);
        }

        return $object;
    }
}

Directory Contents

Dirs: 0 × Files: 4

Name Size Perms Modified Actions
2.75 KB lrw-r--r-- 2026-04-22 07:17:42
Edit Download
1.23 KB lrw-r--r-- 2026-04-22 07:17:42
Edit Download
677 B lrw-r--r-- 2026-04-22 07:17:42
Edit Download
1.30 KB lrw-r--r-- 2026-04-22 07:17:42
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).