protected function getFormMessagesHelper()
    {
        if ($this->formMessagesHelper) {
            return $this->formMessagesHelper;
        }

        if (method_exists($this->view, 'plugin')) {
            $this->formMessagesHelper = $this->view->plugin($this->defaultFormMessagesHelper);
        }

        if (!$this->formMessagesHelper instanceof AbstractHelper) {
            // @todo Ideally the helper should implement an interface.
            throw InvalidHelperException::invalidHelperInstance($this->formMessagesHelper);
        }

        return $this->formMessagesHelper;
    }