src/DMS/Bundle/FilterBundle/Filter/ContainerFilter.php
public function apply(Rule $rule, $value)
    {
        if (!$this->container->has($rule->service)) {
            throw new \RuntimeException("Unable to find service '{$rule->service}' to execute defined rule.");
        }

        $service = $this->container->get($rule->service);

        if (! \is_callable([$service, $rule->method])) {
            throw new \RuntimeException("Unable to find the method '{$rule->method}' in service '{$rule->service}'.");
        }

        $method = $rule->method;

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

        $service = $this->container->get($rule->service);

        if (! \is_callable([$service, $rule->method])) {
            throw new \RuntimeException("Unable to find the method '{$rule->method}' in service '{$rule->service}'.");
        }

        $method = $rule->method;

        return $service->$method($value);
    }
public function apply ( Rule $ rule , $ value ) { if ( ! $ this -> container -> has ( $ rule -> service ) ) { throw new \ RuntimeException ( "Unable to find service '{$rule->service}' to execute defined rule." ) ; } $ service = $ this -> container -> get ( $ rule -> service ) ; if ( ! \ is_callable ( [ $ service , $ rule -> method ] ) ) { throw new \ RuntimeException ( "Unable to find the method '{$rule->method}' in service '{$rule->service}'." ) ; } $ method = $ rule -> method ; return $ service -> $ method ( $ value ) ; }
Enforces the desired filtering on the the value
returning a filtered value.

@param Service|Rule $rule
@param mixed $value

@throws \RuntimeException
@return mixed
Enforces the desired filtering on the the value returning a filtered value .