public function getModuleName()
{
if (null !== $this->moduleName) {
return $this->moduleName;
}
$event = $this->getEvent();
if (!$event instanceof MvcEvent) {
throw new RuntimeException(sprintf('%s cannot operate correctly without a composed MvcEvent', __CLASS__));
}
$matches = $event->getRouteMatch();
$moduleName = $matches->getParam('name', false);
if (!$moduleName) {
throw new RuntimeException(sprintf('%s cannot operate correctly without a "name" segment in the route matches', __CLASS__));
}
$this->moduleName = $moduleName;
return $moduleName;
}