<commit_before><?php

class news_ViewListAction extends news_Action
{
	/**
	 * @return String
	 */
	protected function getTagSuffix()
	{
		return 'list';
	}

	/**
	 * @param Context $context
	 * @param Request $request
	 */
	public function _execute($context, $request)
	{
		$page = null;
		$module = AG_ERROR_404_MODULE;
		$action = AG_ERROR_404_ACTION;

		$document = $this->getSiblingDocumentFromRequest($request);
		if ($document !== null)
		{
			$tag = 'functional_news_news-'.$this->getTagSuffix();
			try
			{
				$page = TagService::getInstance()->getDocumentBySiblingTag($tag, $document);
			}
			catch (TagException $e)
			{
				Framework::exception($e);
				$page = $this->getContextualListPage();
			}

		}
		else
		{
			$page = $this->getContextualListPage();
		}
		if (!is_null($page))
		{
			$request->setParameter(K::PAGE_REF_ACCESSOR, $page->getId());
			$module = 'website';
			$action = 'Display';
		}
		$context->getController()->forward($module, $action);
		return View::NONE;
	}

	private function getContextualListPage()
	{
		try
		{
			return $this->getDocumentService()->getDocumentByContextualTag('contextual_website_website_modules_news_page-'.$this->getTagSuffix(), website_WebsiteModuleService::getInstance()->getCurrentWebsite());
		}
		catch (TagException $e)
		{
			//No taged Page found
			Framework::exception($e);
		}
		return null;
	}

	private function getSiblingDocumentFromRequest($request)
	{
		$documentId = $request->getModuleParameter('news', K::COMPONENT_ID_ACCESSOR);
		if (null === $documentId)<commit_msg>[REFACTOR] Replace usage of some deprecated stuff.<commit_after><?php

class news_ViewListAction extends news_Action
{
	/**
	 * @return String
	 */
	protected function getTagSuffix()
	{
		return 'list';
	}

	/**
	 * @param Context $context
	 * @param Request $request
	 */
	public function _execute($context, $request)
	{
		$page = null;
		$module = AG_ERROR_404_MODULE;
		$action = AG_ERROR_404_ACTION;

		$document = $this->getSiblingDocumentFromRequest($request);
		if ($document !== null)
		{
			$tag = 'functional_news_news-'.$this->getTagSuffix();
			try
			{
				$page = TagService::getInstance()->getDocumentBySiblingTag($tag, $document);
			}
			catch (TagException $e)
			{
				Framework::exception($e);
				$page = $this->getContextualListPage();
			}

		}
		else
		{
			$page = $this->getContextualListPage();
		}
		if (!is_null($page))
		{
			$request->setParameter(K::PAGE_REF_ACCESSOR, $page->getId());
			$module = 'website';
			$action = 'Display';
		}
		$context->getController()->forward($module, $action);
		return View::NONE;
	}

	private function getContextualListPage()
	{
		try
		{
			$website = website_WebsiteModuleService::getInstance()->getCurrentWebsite();
			return TagService::getInstance()->getDocumentByContextualTag('contextual_website_website_modules_news_page-'.$this->getTagSuffix(), $website);
		}
		catch (TagException $e)
		{
			//No taged Page found
			Framework::exception($e);
		}
		return null;
	}

	private function getSiblingDocumentFromRequest($request)
	{
		$documentId = $request->getModuleParameter('news', K::COMPONENT_ID_ACCESSOR);
		if (null === $documentId)
{'fraction_non_alphanumeric': 0.15365159658552008, 'fraction_numerical': 0.0037938665823585203, 'mean_word_length': 4.445783132530121, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, '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': '6020045', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1038, 'n_words': 179}