/** * Dispatch a method. * * @param string $method * * @return mixed */ public function dispatch($method) { $this->assertThatMethodExist($method); $method = $this->reflection->getMethod($method); $arguments = MessageMapperBuilder::normalizeParameters($method->getParameters(), $this->data); return $method->invokeArgs($this->object, $arguments); }
/** * Factory create * * @param string $method * @param mixed $message * * @return static */ public static function factory($method, $message) { return MessageMapperBuilder::call(get_called_class(), $method, $message); }