<commit_before><?php
namespace ITT\View\Helper;

use Zend\View\Helper\AbstractHelper;
use Zend\View\HelperPluginManager;

class CurrentRouteName extends AbstractHelper {
	
	protected $helperPluginManager;
	
	public function __construct(HelperPluginManager $serviceManager) {
		$this->helperPluginManager = $serviceManager;
	}
	
	public function __invoke() {
		$serviceLocator =  $this->helperPluginManager->getServiceLocator();
		$currentRouteName = $serviceLocator->get('Application')->getMvcEvent()->getRouteMatch()->getMatchedRouteName();
		return $currentRouteName;
	}
	
}<commit_msg>Preventing Fatal error:  Call to a member function getMatchedRouteName() on a non-object in CurrentRouteName.php on line 17<commit_after><?php
namespace ITT\View\Helper;

use Zend\View\Helper\AbstractHelper;
use Zend\View\HelperPluginManager;
use Zend\Mvc\Router\RouteMatch;

class CurrentRouteName extends AbstractHelper {
	
	protected $helperPluginManager;
	
	public function __construct(HelperPluginManager $serviceManager) {
		$this->helperPluginManager = $serviceManager;
	}
	
	public function __invoke() {
		$serviceLocator = $this->helperPluginManager->getServiceLocator();
		if($serviceLocator->get('Application')->getMvcEvent()->getRouteMatch() instanceof RouteMatch) {
			$currentRouteName = $serviceLocator->get('Application')->getMvcEvent()->getRouteMatch()->getMatchedRouteName();
		} else {
			$currentRouteName = null;
		}
		return $currentRouteName;
	}
	
}
{'fraction_non_alphanumeric': 0.11575342465753424, 'fraction_numerical': 0.0013698630136986301, 'mean_word_length': 6.454081632653061, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1787859', 'n_tokens_mistral': 442, 'n_tokens_neox': 411, 'n_words': 80}