We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3e5caf5 commit 45f2d8fCopy full SHA for 45f2d8f
app/Wordpress.php
@@ -57,6 +57,25 @@ public function setCredentials(AuthInterface $auth)
57
$this->credentials = $auth;
58
}
59
60
+ /**
61
+ * @param $endpoint
62
+ * @param array $args
63
+ * @return Endpoint\AbstractWpEndpoint
64
+ */
65
+ public function __call($endpoint, array $args)
66
+ {
67
+ if (!isset($this->endPoints[$endpoint])) {
68
+ $class = 'Reactmore\WordpressClient\Endpoint\\' . ucfirst($endpoint);
69
+ if (class_exists($class)) {
70
+ $this->endPoints[$endpoint] = new $class($this);
71
+ } else {
72
+ throw new RuntimeException('Endpoint "' . $endpoint . '" does not exist"');
73
+ }
74
75
+
76
+ return $this->endPoints[$endpoint];
77
78
79
/**
80
* @param RequestInterface $request
81
* @return ResponseInterface
0 commit comments