PHP 8.2.31
Preview: AssociativeArrayResolver.php Size: 1.08 KB
/opt/cpanel/ea-wappspector/vendor/php-di/invoker/src/ParameterResolver/AssociativeArrayResolver.php

<?php declare(strict_types=1);

namespace Invoker\ParameterResolver;

use ReflectionFunctionAbstract;

/**
 * Tries to map an associative array (string-indexed) to the parameter names.
 *
 * E.g. `->call($callable, ['foo' => 'bar'])` will inject the string `'bar'`
 * in the parameter named `$foo`.
 *
 * Parameters that are not indexed by a string are ignored.
 */
class AssociativeArrayResolver implements ParameterResolver
{
    public function getParameters(
        ReflectionFunctionAbstract $reflection,
        array $providedParameters,
        array $resolvedParameters
    ): array {
        $parameters = $reflection->getParameters();

        // Skip parameters already resolved
        if (! empty($resolvedParameters)) {
            $parameters = array_diff_key($parameters, $resolvedParameters);
        }

        foreach ($parameters as $index => $parameter) {
            if (array_key_exists($parameter->name, $providedParameters)) {
                $resolvedParameters[$index] = $providedParameters[$parameter->name];
            }
        }

        return $resolvedParameters;
    }
}

Directory Contents

Dirs: 1 × Files: 6

Name Size Perms Modified Actions
Container DIR
- drwxr-xr-x 2025-08-30 10:22:22
Edit Download
1.08 KB lrw-r--r-- 2025-08-30 10:22:22
Edit Download
1.34 KB lrw-r--r-- 2025-08-30 10:22:22
Edit Download
1.04 KB lrw-r--r-- 2025-08-30 10:22:22
Edit Download
972 B lrw-r--r-- 2025-08-30 10:22:22
Edit Download
1.58 KB lrw-r--r-- 2025-08-30 10:22:22
Edit Download
1.58 KB lrw-r--r-- 2025-08-30 10:22:22
Edit Download

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