PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.8.0
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.8.0
4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.5.2 All 199 releases
betterdocs / includes / Dependencies / Invoker / Exception / NotCallableException.php

NotCallableException.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.8.0, at includes/Dependencies/Invoker/Exception/NotCallableException.php

35 lines 1.3 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 // phpcs:ignoreFile -- Bundled third-party (Mozart) dependency; exempt from plugin coding standards.
3
4 namespace WPDeveloper\BetterDocs\Dependencies\Invoker\Exception;
5
6 /**
7 * The given callable is not actually callable.
8 */
9 class NotCallableException extends InvocationException
10 {
11 /**
12 * @param mixed $value
13 */
14 public static function fromInvalidCallable($value, bool $containerEntry = false): self
15 {
16 if (is_object($value)) {
17 $message = sprintf('Instance of %s is not a callable', get_class($value));
18 } elseif (is_array($value) && isset($value[0], $value[1])) {
19 $class = is_object($value[0]) ? get_class($value[0]) : $value[0];
20
21 $extra = method_exists($class, '__call') || method_exists($class, '__callStatic')
22 ? ' A __call() or __callStatic() method exists but magic methods are not supported.'
23 : '';
24
25 $message = sprintf('%s::%s() is not a callable.%s', $class, $value[1], $extra);
26 } elseif ($containerEntry) {
27 $message = var_export($value, true) . ' is neither a callable nor a valid container entry';
28 } else {
29 $message = var_export($value, true) . ' is not a callable';
30 }
31
32 return new self($message);
33 }
34 }
35