Server IP : 104.21.14.48 / Your IP : 18.117.106.78 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/plugins/defender-security/lib/packages/Invoker/Reflection/ |
Upload File : |
<?php declare(strict_types=1); namespace WPMU_DEV\Defender\Vendor\Invoker\Reflection; use Closure; use WPMU_DEV\Defender\Vendor\Invoker\Exception\NotCallableException; use ReflectionException; use ReflectionFunction; use ReflectionFunctionAbstract; use ReflectionMethod; /** * Create a reflection object from a callable or a callable-like. * * @internal */ class CallableReflection { /** * @param callable|array|string $callable Can be a callable or a callable-like. * @throws NotCallableException|ReflectionException */ public static function create($callable): ReflectionFunctionAbstract { // Closure if ($callable instanceof Closure) { return new ReflectionFunction($callable); } // Array callable if (is_array($callable)) { [$class, $method] = $callable; if (! method_exists($class, $method)) { throw NotCallableException::fromInvalidCallable($callable); } return new ReflectionMethod($class, $method); } // Callable object (i.e. implementing __invoke()) if (is_object($callable) && method_exists($callable, '__invoke')) { return new ReflectionMethod($callable, '__invoke'); } // Standard function if (is_string($callable) && function_exists($callable)) { return new ReflectionFunction($callable); } throw new NotCallableException(sprintf( '%s is not a callable', is_string($callable) ? $callable : 'Instance of ' . get_class($callable) )); } }