protected function processOptions(array $options)
    {
        foreach ($options as $name => $value) {

            if (is_callable($value)) {

                $options[$name] = call_user_func($value, $this->data, $options);
            } elseif (is_object($value) && !method_exists($value, '__toString')) {

                throw new \InvalidArgumentException(
                    'the value of an option must be either castable to a string or callable'
                );
            }
        }

        return $options;
    }