<commit_before><?php
/**
 * Class Tasks
 *
 * @author: <NAME> <<EMAIL>>
 * @date: 27.08.13
 */
namespace Tasker;

use Tasker\Tasks\ITask;

class TasksContainer
{

	/** @var array  */
	private $tasks = array();

	/**
	 * @param ITask $task
	 * @throws \InvalidArgumentException
	 */
	public function registerTask(ITask $task)
	{
		if(isset($this->tasks[$task->getName()])) {
			throw new \InvalidArgumentException;
		}

		$this->tasks[$task->getName()] = $task;
	}

	/**
	 * @param $name
	 * @param bool $need
	 * @return ITask|null
	 * @throws \InvalidArgumentException
	 */
	public function getTask($name, $need = true)
	{
		if(isset($this->tasks[$name])) {
			return $this->tasks[$name];
		}

		if($need === true) {
			throw new \InvalidArgumentException;
		}
	}

	/**
	 * @return array
	 */
	public function getTasksName()
	{
		return array_keys($this->getTasks());
	}

	/**
	 * @return array
	 */
	public function getTasks()
	{
		return $this->tasks;
	}
}<commit_msg>Implement Tasker exceptions<commit_after><?php
/**
 * Class Tasks
 *
 * @author: <NAME> <<EMAIL>>
 * @date: 27.08.13
 */
namespace Tasker;

use Tasker\Tasks\ITask;
use Tasker\InvalidStateException;
use Tasker\InvalidArgumentException;

class TasksContainer
{

	/** @var array  */
	private $tasks = array();

	/**
	 * @param ITask $task
	 * @throws InvalidStateException
	 */
	public function registerTask(ITask $task)
	{
		if(isset($this->tasks[$task->getName()])) {
			throw new InvalidStateException('Task with same name "' . $task->getName() . ' exist yet.');
		}

		$this->tasks[$task->getName()] = $task;
	}

	/**
	 * @param $name
	 * @param bool $need
	 * @return mixed
	 * @throws InvalidArgumentException
	 */
	public function getTask($name, $need = true)
	{
		if(isset($this->tasks[$name])) {
			return $this->tasks[$name];
		}

		if($need === true) {
			throw new InvalidArgumentException('Task with name "' . $name . '" does not exist.');
		}
	}

	/**
	 * @return array
	 */
	public function getTasksName()
	{
		return array_keys($this->getTasks());
	}

	/**
	 * @return array
	 */
	public function getTasks()
	{
		return $this->tasks;
	}
}
{'fraction_non_alphanumeric': 0.18001885014137606, 'fraction_numerical': 0.005655042412818096, 'mean_word_length': 3.404564315352697, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 26, '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': '7626567', 'n_tokens_mistral': 790, 'n_tokens_neox': 712, 'n_words': 158}