for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Yoanm\JsonRpcServer\Infra\Resolver;
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcMethodInterface;
use Yoanm\JsonRpcServer\Domain\Model\MethodResolverInterface;
use Yoanm\JsonRpcServer\Domain\Exception\JsonRpcMethodNotFoundException;
/**
* Class DefaultMethodResolver
*/
class DefaultMethodResolver implements MethodResolverInterface
{
/** @var JsonRpcMethodInterface[] */
private $methodList = [];
* {@inheritdoc}
public function resolve(string $methodName) : JsonRpcMethodInterface
// TODO: Implement resolve() method.
if (!isset($this->methodList[$methodName])) {
throw new JsonRpcMethodNotFoundException($methodName);
}
return $this->methodList[$methodName];
* @param string $methodName
* @param JsonRpcMethodInterface $method
public function addMethod(string $methodName, JsonRpcMethodInterface $method)
$this->methodList[$methodName] = $method;