?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/Invoker.php.tar
???????
opt/cpanel/ea-wappspector/vendor/phpunit/php-invoker/src/Invoker.php 0000644 00000003320 15126256245 0021713 0 ustar 00 <?php declare(strict_types=1); /* * This file is part of phpunit/php-invoker. * * (c) Sebastian Bergmann <sebastian@phpunit.de> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SebastianBergmann\Invoker; use const SIGALRM; use function call_user_func_array; use function function_exists; use function pcntl_alarm; use function pcntl_async_signals; use function pcntl_signal; use function sprintf; use Throwable; final class Invoker { private int $timeout; /** * @throws Throwable */ public function invoke(callable $callable, array $arguments, int $timeout): mixed { if (!$this->canInvokeWithTimeout()) { throw new ProcessControlExtensionNotLoadedException( 'The pcntl (process control) extension for PHP is required' ); } pcntl_signal( SIGALRM, function (): void { throw new TimeoutException( sprintf( 'Execution aborted after %d second%s', $this->timeout, $this->timeout === 1 ? '' : 's' ) ); }, true ); $this->timeout = $timeout; pcntl_async_signals(true); pcntl_alarm($timeout); try { return call_user_func_array($callable, $arguments); } finally { pcntl_alarm(0); } } public function canInvokeWithTimeout(): bool { return function_exists('pcntl_signal') && function_exists('pcntl_async_signals') && function_exists('pcntl_alarm'); } } opt/cpanel/ea-wappspector/vendor/php-di/invoker/src/Invoker.php 0000644 00000006411 15127616573 0020631 0 ustar 00 <?php declare(strict_types=1); namespace Invoker; use Invoker\Exception\NotCallableException; use Invoker\Exception\NotEnoughParametersException; use Invoker\ParameterResolver\AssociativeArrayResolver; use Invoker\ParameterResolver\DefaultValueResolver; use Invoker\ParameterResolver\NumericArrayResolver; use Invoker\ParameterResolver\ParameterResolver; use Invoker\ParameterResolver\ResolverChain; use Invoker\Reflection\CallableReflection; use Psr\Container\ContainerInterface; use ReflectionParameter; /** * Invoke a callable. */ class Invoker implements InvokerInterface { /** @var CallableResolver|null */ private $callableResolver; /** @var ParameterResolver */ private $parameterResolver; /** @var ContainerInterface|null */ private $container; public function __construct(?ParameterResolver $parameterResolver = null, ?ContainerInterface $container = null) { $this->parameterResolver = $parameterResolver ?: $this->createParameterResolver(); $this->container = $container; if ($container) { $this->callableResolver = new CallableResolver($container); } } /** * {@inheritdoc} */ public function call($callable, array $parameters = []) { if ($this->callableResolver) { $callable = $this->callableResolver->resolve($callable); } if (! is_callable($callable)) { throw new NotCallableException(sprintf( '%s is not a callable', is_object($callable) ? 'Instance of ' . get_class($callable) : var_export($callable, true) )); } $callableReflection = CallableReflection::create($callable); $args = $this->parameterResolver->getParameters($callableReflection, $parameters, []); // Sort by array key because call_user_func_array ignores numeric keys ksort($args); // Check all parameters are resolved $diff = array_diff_key($callableReflection->getParameters(), $args); $parameter = reset($diff); if ($parameter && \assert($parameter instanceof ReflectionParameter) && ! $parameter->isVariadic()) { throw new NotEnoughParametersException(sprintf( 'Unable to invoke the callable because no value was given for parameter %d ($%s)', $parameter->getPosition() + 1, $parameter->name )); } return call_user_func_array($callable, $args); } /** * Create the default parameter resolver. */ private function createParameterResolver(): ParameterResolver { return new ResolverChain([ new NumericArrayResolver, new AssociativeArrayResolver, new DefaultValueResolver, ]); } /** * @return ParameterResolver By default it's a ResolverChain */ public function getParameterResolver(): ParameterResolver { return $this->parameterResolver; } public function getContainer(): ?ContainerInterface { return $this->container; } /** * @return CallableResolver|null Returns null if no container was given in the constructor. */ public function getCallableResolver(): ?CallableResolver { return $this->callableResolver; } }
| ver. 1.6 |
Github
|
.
| PHP 8.2.30 | ??????????? ?????????: 0 |
proxy
|
phpinfo
|
???????????