public function apply(Rule $rule, $value)
{
if (!$this->container->has($rule->service)) {
throw new \Exception("Unable to find service '{$rule->service}' to execute defined rule.");
}
$service = $this->container->get($rule->service);
if (!method_exists($service, $rule->method)) {
throw new \Exception("Unable to find the method '{$rule->method}' in service '{$rule->service}'.");
}
$method = $rule->method;
return $service->{$method}($value);
}