Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@..

Decoded Output download

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\AssetMapper\ImportMap;

/**
 * Holds the collection of importmap entries defined in importmap.php.
 *
 * @template-implements \IteratorAggregate<ImportMapEntry>
 *
 * @author Ryan Weaver <[email protected]>
 */
class ImportMapEntries implements \IteratorAggregate
{
    private array $entries = [];

    /**
     * @param ImportMapEntry[] $entries
     */
    public function __construct(array $entries = [])
    {
        foreach ($entries as $entry) {
            $this->add($entry);
        }
    }

    public function add(ImportMapEntry $entry): void
    {
        $this->entries[$entry->importName] = $entry;
    }

    public function has(string $importName): bool
    {
        return isset($this->entries[$importName]);
    }

    public function get(string $importName): ImportMapEntry
    {
        if (!$this->has($importName)) {
            throw new \InvalidArgumentException(sprintf('The importmap entry "%s" does not exist.', $importName));
        }

        return $this->entries[$importName];
    }

    /**
     * @return \Traversable<ImportMapEntry>
     */
    public function getIterator(): \Traversable
    {
        return new \ArrayIterator(array_values($this->entries));
    }

    public function remove(string $packageName): void
    {
        unset($this->entries[$packageName]);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\AssetMapper\ImportMap;

/**
 * Holds the collection of importmap entries defined in importmap.php.
 *
 * @template-implements \IteratorAggregate<ImportMapEntry>
 *
 * @author Ryan Weaver <[email protected]>
 */
class ImportMapEntries implements \IteratorAggregate
{
    private array $entries = [];

    /**
     * @param ImportMapEntry[] $entries
     */
    public function __construct(array $entries = [])
    {
        foreach ($entries as $entry) {
            $this->add($entry);
        }
    }

    public function add(ImportMapEntry $entry): void
    {
        $this->entries[$entry->importName] = $entry;
    }

    public function has(string $importName): bool
    {
        return isset($this->entries[$importName]);
    }

    public function get(string $importName): ImportMapEntry
    {
        if (!$this->has($importName)) {
            throw new \InvalidArgumentException(sprintf('The importmap entry "%s" does not exist.', $importName));
        }

        return $this->entries[$importName];
    }

    /**
     * @return \Traversable<ImportMapEntry>
     */
    public function getIterator(): \Traversable
    {
        return new \ArrayIterator(array_values($this->entries));
    }

    public function remove(string $packageName): void
    {
        unset($this->entries[$packageName]);
    }
}

Function Calls

None

Variables

None

Stats

MD5 701ba4ece825091b1c67aa79b0d674fd
Eval Count 0
Decode Time 91 ms