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:----lExf7N4HTg3f06WvRaonHiLki6sBe6sXzXaJU99POg+q9UuKoPRFDWjq1xqjtiDviBI2/2xGJRgBsP3cYVzSyVF56j4ylcogKZK7q0/iWaH/q2lBu9o9FssJdp8P+K3Jk0uxi4hisbPWx+fHL9jMv1deiee4JVzT1usP1qQTT833823i4zQ5U6ERL+JHbmmXhjEIx/FUOD6oey/ThsPp4MlRpPzCrN6v4HjJ5+9c63/eCwxIdxCuapj8/qU9konyK3JtcRcOsfs/HaMM+xhhvvtbbwVD7OUG+RGreeIrM4F8Fg1cv72drKiiBQFkG1/o9Xnq515ddBcp1KvuxNAdotuJNIK67IcXPEBE3j5PdQuyOS9Byvs0+FPgXJouVt8Imd2A8sV4rb964VmwG937WOE4f6SBbRC+m0dPyJwx+ZvB9Omo7VogljMrDrT7+vbC3poD/eNwt+xnHFe7Vt6ENlSWS9CtS2DYvUaV0On16nhNjrcidIcg1WdFUOLto/Qe9oje11jp1SEWoWcxNClQRlkJ2aD4JqLd5IzjEukGEo7Jt0oevAj0QSE+G3sGFURbhO79C2KfEZ3ygXAZiB5BHoGjdRRlR1WriJ5CCDowkI3miF5T5SOr9Bf60yE0ipAu49NB7bFjzVRCgKID/EXHYShNiwvwAprZRKr6F5d7Umo=----ATTACHMENT:----OTM3MjkwNzI2NDcyMTQxNyAyMzU2MDAwNjcyOTY1Mjk5IDgyNzgyMDU0ODU5NDk3ODA=