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

use Zend\View\Helper\AbstractHelper;   

class DateFormat extends AbstractHelper
{  	
	private $timestamp;
	
	public function __invoke($date) {
	
		$this->timestamp = $date;
		
		return $this;	
	}
	
	public function forumDate()
	{		
		if($this->timestamp > strtotime(date('Y-m-d')))
			return date('H:i', $this->timestamp);
		else if(date('Y',$this->timestamp) == date('Y'))
			return date('d-m H:i', $this->timestamp);
		else 
			return date('d M y H:i', $this->timestamp);
	}
	
	public function ago($afterDayDate = false)
	{		
		$time = time() - $this->timestamp;
		$translate = $this->view->plugin('translate');
		
		if($time < 60) {
			$agoString = $translate('nu');
		} else if($time < 60) {
			$agoTime = $time;
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('second ago') : $translate('seconds ago'));
		} else if($time < 3600) {
			$agoTime = round($time / 60);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('minute ago') : $translate('minutes ago'));
		} else if($time < 86400) {
			$agoTime = round(($time / 60) / 24);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('hour ago') : $translate('hours ago'));
		} else if($time < 604800 && $afterDayDate !== false) {
			$agoTime = round($time / 86400);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('day ago') : $translate('days ago'));
		} else if($time < 2592000 && $afterDayDate !== false) {
			$agoTime = round($time / 604800);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('week ago') : $translate('weeks ago'));
		} else if($time < 31536000 && $afterDayDate !== false) {
			$agoTime = round($time / 2592000);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('month ago') : $translate('months ago'));
		} else if($time < 157680000 && $afterDayDate !== false) {
			$agoTime = round($time / 31536000);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('year ago') : $translate('years ago'));
		} else {
			$agoString = date('d M y H:i', $this->timestamp); 			
		}
		<commit_msg>ago($afterDayDate = false)<commit_after><?php
  
namespace MQUtil\View\Helper;  

use Zend\View\Helper\AbstractHelper;   

class DateFormat extends AbstractHelper
{  	
	private $timestamp;
	
	public function __invoke($date) {
	
		$this->timestamp = $date;
		
		return $this;	
	}
	
	public function forumDate()
	{		
		if($this->timestamp > strtotime(date('Y-m-d')))
			return date('H:i', $this->timestamp);
		else if(date('Y',$this->timestamp) == date('Y'))
			return date('d-m H:i', $this->timestamp);
		else 
			return date('d M y H:i', $this->timestamp);
	}
	
	public function ago($afterDayDate = false)
	{		
		$time = time() - $this->timestamp;
		$translate = $this->view->plugin('translate');
		
		if($time < 60) {
			$agoString = $translate('nu');
		} else if($time < 60) {
			$agoTime = $time;
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('second ago') : $translate('seconds ago'));
		} else if($time < 3600) {
			$agoTime = round($time / 60);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('minute ago') : $translate('minutes ago'));
		} else if($time < 86400) {
			$agoTime = round(($time / 60) / 24);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('hour ago') : $translate('hours ago'));
		} else if($time < 604800 && $afterDayDate == false) {
			$agoTime = round($time / 86400);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('day ago') : $translate('days ago'));
		} else if($time < 2592000 && $afterDayDate == false) {
			$agoTime = round($time / 604800);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('week ago') : $translate('weeks ago'));
		} else if($time < 31536000 && $afterDayDate == false) {
			$agoTime = round($time / 2592000);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('month ago') : $translate('months ago'));
		} else if($time < 157680000 && $afterDayDate == false) {
			$agoTime = round($time / 31536000);
			$agoString = $agoTime . ' ' . sprintf(($agoTime == 1) ? $translate('year ago') : $translate('years ago'));
		} else {
			$agoString = date('d M y H:i', $this->timestamp); 			
		}
		
{'fraction_non_alphanumeric': 0.20903823870220162, 'fraction_numerical': 0.038006952491309386, 'mean_word_length': 3.6458557588805167, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 25, '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': '915257', 'n_tokens_mistral': 1770, 'n_tokens_neox': 1495, 'n_words': 333}