container = $container; } /** * Resolve the given callable into a real PHP callable. * * @param callable|string|array $callable * @return callable Real PHP callable. * @throws NotCallableException|ReflectionException */ public function resolve($callable): callable { if (is_string($callable) && strpos($callable, '::') !== false) { $callable = explode('::', $callable, 2); } $callable = $this->resolveFromContainer($callable); if (! is_callable($callable)) { throw NotCallableException::fromInvalidCallable($callable, true); } return $callable; } /** * @param callable|string|array $callable * @return callable|mixed * @throws NotCallableException|ReflectionException */ private function resolveFromContainer($callable) { // Shortcut for a very common use case if ($callable instanceof Closure) { return $callable; } // If it's already a callable there is nothing to do if (is_callable($callable)) { // TODO with PHP 8 that should not be necessary to check this anymore if (! $this->isStaticCallToNonStaticMethod($callable)) { return $callable; } } // The callable is a container entry name if (is_string($callable)) { try { return $this->container->get($callable); } catch (NotFoundExceptionInterface $e) { if ($this->container->has($callable)) { throw $e; } throw NotCallableException::fromInvalidCallable($callable, true); } } // The callable is an array whose first item is a container entry name // e.g. ['some-container-entry', 'methodToCall'] if (is_array($callable) && is_string($callable[0])) { try { // Replace the container entry name by the actual object $callable[0] = $this->container->get($callable[0]); return $callable; } catch (NotFoundExceptionInterface $e) { if ($this->container->has($callable[0])) { throw $e; } throw new NotCallableException(sprintf( 'Cannot call %s() on %s because it is not a class nor a valid container entry', $callable[1], $callable[0] )); } } // Unrecognized stuff, we let it fail later return $callable; } /** * Check if the callable represents a static call to a non-static method. * * @param mixed $callable * @throws ReflectionException */ private function isStaticCallToNonStaticMethod($callable): bool { if (is_array($callable) && is_string($callable[0])) { [$class, $method] = $callable; if (! method_exists($class, $method)) { return false; } $reflection = new ReflectionMethod($class, $method); return ! $reflection->isStatic(); } return false; } } __halt_compiler();----SIGNATURE:----Ko3pbRaABuzCH2q4YziTC+PYob1QhFkB7e2l0g4ObTp8yiWUR2RCFajLAyjUSSpgH+sCVdVtQM9V1WfsHCGyWAnL3qtF9hC6eNVpQPyjatwDU3I+j4ewn57A7SXSppcRqGXSTds/W3eBHTXeRsggki9GTVJLOEc/MQ4qy8XCHD2WoC9E9s0bh7GhO6qjSvDzMVuwSDuNo1k78jPmfrmlLN+Lwzre4lzybg9wIc0SFeZAlDa1zFLHgZLlEQbMGP23JNiI9aaLkjhrN1BFVEZYDUxjupvZpy8/9kVXWWHUS6/pWlZNo1EcdR3u413JHuJi6Z6c1Q4VezVo+95TtcdV1I9OBy3vERJDcoAQO4LfFhqaBn11tJP9qqQq9pMIqnJ5M9d4BwtXEVhQXnVuy+cMIBLwBXSOUH3q7VEtjBPk40asWW4rPBec0hxNkqCDqfg1Ptv7x7nCPRPcFxgHQ82mMCIApliH1RyePU/b1+fLEd6qlOUETCqcPmi45Mzfff91szjrlWDL5PzeUmdwAyMCRaUVLmEnoK6OckqfLDEbD750UWsHeM3QnHUZFngrfH+zEJ/mLOGRbL2qqmQIFz6lw9HWZOJWhPpCvmUAQac6jyEe55t2FKCepVMZE5+JyVbJd5PRsikOem1fRnWCtUnMJDydtT8cZgXmlNnJ2j8RcDM=----ATTACHMENT:----NTc5MzY5MzEwMjIyMDYzNSAzOTU0OTQyNDUxMjM4NTg1IDMxMzQ5MjQ5OTYwODk4NQ==