<commit_before><?php

class IndexController extends Zend_Controller_Action
{

    public function indexAction()
    {
    	$substitution = array(
			array('name' => 'Alex', 'date' => date('d-m-Y', strtotime('now')), 'text' => 'Test message from user 1'),
			array('name' => 'Dmitry', 'date' => date('d-m-Y', strtotime('one hour ago')), 'text' => 'Test message from user 2'),
			array('name' => 'Jack', 'date' => date('d-m-Y', strtotime('two hour ago')), 'text' => 'Hello world'),
		);

		$messages = InstantMessage_Broker::getInstance();
		foreach ($substitution as $values)
		{
			$messages->addMessage('hello', $values, 'FileMessage', array('extension' => '.phtml'));
		}
		
		$this->view->messages = $messages->getMessages();
    }
	
	/**
	 * Base usage
	 */
	public function baseusageAction()
	{
		$this->_helper->viewRenderer->setNoRender();
		
		$message = new InstantMessage_Message_FileMessage('hello', array('name' => 'Dmitry'));
		
		$message->text = 'Hello world!';
		$message->date = date('Y-m-d', time());
		
		
		// or echo $message;
		echo $message->render();
	}

	public function twitterAction()
	{
		$lastTweet = new Zend_Session_Namespace('tweet');
		
		$messages = InstantMessage_Broker::getInstance();
		
		$tweets = @simplexml_load_file('http://api.twitter.com/1/statuses/public_timeline.xml');

		if ($tweets)
		{
			foreach ($tweets->status as $tweet)
			{
				$values = new stdClass();
				
				$values->name = $tweet->user->screen_name;
				$values->time = date('d-m-Y', strtotime($tweet->created_at));
				$values->text = $tweet->text;
	
				$messages->addMessage('tweet', $values);
			}
	
			$this->view->count = count($tweets->status);
			$this->view->tweets = $messages->getMessages();
		}
	}
	
	public function ajaxtweetAction()
	{
		$this->_helper->viewRenderer->setNoRender();
		
		$messages = InstantMessage_Broker::getInstance();
		
		$tweets = @simplexml_load_file('http://api.twitter.com/1/statuses/public_timeline.xml');
		if ($tweets)
		{
			$tweet = isset($tweets->status[0]) ? $tweets->status[0] : false;
			if ($tweet)
			{
				$message = new InstantMessage_Message_FileMessage('tweet');
				$message->name = $tweet->user->screen_name;
				$message->time = date('d-m-Y', strtotime($tweet->created_at));
				$message->text = $tweet->text;
				
				// or echo $message;
				echo $message->render();
			}
		}
	}
	
	public function removeAction()
	{
		$this->_helper->viewRenderer->setNoRender();
		
		$messagesBroker = InstantMessage_Broker::getInstance();
		
		//create message
		$message = new InstantMessage_Message_FileMessage('hello');
		$message->name = 'Bill';
		$message->time = date('d-m-Y', strtotime('now'));
		$message->text = 'Some text';
		
		$messagesBroker->setMessage($message);
		
		echo 'Before remove:';
		var_dump($messagesBroker->getMessages());
		
		// remove message by object
		$messagesBroker->removeMessage($message);
		
		echo 'After remove:';
		var_dump($messagesBroker->getMessages());
		
	}
}
<commit_msg>Formatting array output<commit_after><?php

class IndexController extends Zend_Controller_Action
{

    public function indexAction()
    {
    	$substitution = array(
			array('name' => 'Alex', 'date' => date('d-m-Y', strtotime('now')), 'text' => 'Test message from user 1'),
			array('name' => 'Dmitry', 'date' => date('d-m-Y', strtotime('one hour ago')), 'text' => 'Test message from user 2'),
			array('name' => 'Jack', 'date' => date('d-m-Y', strtotime('two hour ago')), 'text' => 'Hello world'),
		);

		$messages = InstantMessage_Broker::getInstance();
		foreach ($substitution as $values)
		{
			$messages->addMessage('hello', $values, 'FileMessage', array('extension' => '.phtml'));
		}
		
		$this->view->messages = $messages->getMessages();
    }
	
	/**
	 * Base usage
	 */
	public function baseusageAction()
	{
		$this->_helper->viewRenderer->setNoRender();
		
		$message = new InstantMessage_Message_FileMessage('hello', array('name' => 'Dmitry'));
		
		$message->text = 'Hello world!';
		$message->date = date('Y-m-d', time());
		
		
		// or echo $message;
		echo $message->render();
	}

	public function twitterAction()
	{
		$lastTweet = new Zend_Session_Namespace('tweet');
		
		$messages = InstantMessage_Broker::getInstance();
		
		$tweets = @simplexml_load_file('http://api.twitter.com/1/statuses/public_timeline.xml');

		if ($tweets)
		{
			foreach ($tweets->status as $tweet)
			{
				$values = new stdClass();
				
				$values->name = $tweet->user->screen_name;
				$values->time = date('d-m-Y', strtotime($tweet->created_at));
				$values->text = $tweet->text;
	
				$messages->addMessage('tweet', $values);
			}
	
			$this->view->count = count($tweets->status);
			$this->view->tweets = $messages->getMessages();
		}
	}
	
	public function ajaxtweetAction()
	{
		$this->_helper->viewRenderer->setNoRender();
		
		$messages = InstantMessage_Broker::getInstance();
		
		$tweets = @simplexml_load_file('http://api.twitter.com/1/statuses/public_timeline.xml');
		if ($tweets)
		{
			$tweet = isset($tweets->status[0]) ? $tweets->status[0] : false;
			if ($tweet)
			{
				$message = new InstantMessage_Message_FileMessage('tweet');
				$message->name = $tweet->user->screen_name;
				$message->time = date('d-m-Y', strtotime($tweet->created_at));
				$message->text = $tweet->text;
				
				// or echo $message;
				echo $message->render();
			}
		}
	}
	
	public function removeAction()
	{
		$this->_helper->viewRenderer->setNoRender();
		
		$messagesBroker = InstantMessage_Broker::getInstance();
		
		//create message
		$message = new InstantMessage_Message_FileMessage('hello');
		$message->name = 'Bill';
		$message->time = date('d-m-Y', strtotime('now'));
		$message->text = 'Some text';
		
		$messagesBroker->setMessage($message);
		
		echo 'Before remove:';
		echo '<pre>';
		var_dump($messagesBroker->getMessages());
		echo '</pre>';
		
		// remove message by object
		$messagesBroker->removeMessage($message);
		
		echo 'After remove:';
		echo '<pre>';
		var_dump($messagesBroker->getMessages());
		echo '</pre>';
		
	}
}

{'fraction_non_alphanumeric': 0.19189907038512616, 'fraction_numerical': 0.00199203187250996, 'mean_word_length': 3.9425758818703858, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 125, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '241707', 'n_tokens_mistral': 2356, 'n_tokens_neox': 1997, 'n_words': 360}