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;
/**
* Class ArrayMethodResolver
*/
class ArrayMethodResolver implements MethodResolverInterface
{
/** @var JsonRpcMethodInterface[] */
private $methodList = [];
* {@inheritdoc}
public function resolve(string $methodName)
return array_key_exists($methodName, $this->methodList)
? $this->methodList[$methodName]
: null
;
}
* @param JsonRpcMethodInterface $method
* @param string $methodName
*
* @return ArrayMethodResolver
public function addMethod(JsonRpcMethodInterface $method, string $methodName) : ArrayMethodResolver
$this->methodList[$methodName] = $method;
return $this;