PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.8.1
Defender Security – Malware Scanner, Login Security & Firewall v5.8.1
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / lib / packages / Invoker / Exception / NotCallableException.php

NotCallableException.php in Defender Security – Malware Scanner, Login Security & Firewall 5.8.1, at lib/packages/Invoker/Exception/NotCallableException.php

34 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 namespace WPMU_DEV\Defender\Vendor\Invoker\Exception;
4
5 /**
6 * The given callable is not actually callable.
7 */
8 class NotCallableException extends InvocationException
9 {
10 /**
11 * @param mixed $value
12 */
13 public static function fromInvalidCallable($value, bool $containerEntry = false): self
14 {
15 if (is_object($value)) {
16 $message = sprintf('Instance of %s is not a callable', get_class($value));
17 } elseif (is_array($value) && isset($value[0], $value[1])) {
18 $class = is_object($value[0]) ? get_class($value[0]) : $value[0];
19
20 $extra = method_exists($class, '__call') || method_exists($class, '__callStatic')
21 ? ' A __call() or __callStatic() method exists but magic methods are not supported.'
22 : '';
23
24 $message = sprintf('%s::%s() is not a callable.%s', $class, $value[1], $extra);
25 } elseif ($containerEntry) {
26 $message = var_export($value, true) . ' is neither a callable nor a valid container entry';
27 } else {
28 $message = var_export($value, true) . ' is not a callable';
29 }
30
31 return new self($message);
32 }
33 }
34