<commit_before><?php
namespace Kir\Dispatching;

use Kir\Dispatching\Tools\MethodInvoker;

class Dispatcher {
	/**
	 * @var MethodInvoker
	 */
	private $invoker = null;

	/**
	 * @var InstanceFactory
	 */
	private $instanceFactory;

	/**
	 * @param InstanceFactory $instanceFactory
	 * @param MethodInvoker $invoker
	 */
	public function __construct(InstanceFactory $instanceFactory, MethodInvoker $invoker) {
		$this->invoker = $invoker;
		$this->instanceFactory = $instanceFactory;
	}

	/**
	 * @param string $className
	 * @return object
	 */
	public function createInstance($className) {
		return $this->instanceFactory->createInstance($className);
	}

	/**
	 * @param object $instance
	 * @param string $method
	 * @param array $params
	 * @throws \Exception
	 * @return mixed
	 */
	public function invokeMethod($instance, $method, $params) {
		return $this->invoker->invoke($instance, $method, $params);
	}

	/**
	 * @param string $className
	 * @param string $method
	 * @param array $params
	 * @throws Exceptions\BadInstanceFoundException
	 * @throws Exceptions\MethodNotFoundException
	 * @return mixed
	 */
	public function invoke($className, $method, array $params) {
		$instance = $this->createInstance($className);
		return $this->invokeMethod($instance, $method, $params);
	}
}<commit_msg>Not necessary to provide an empty array for Dispatcher::invokeMethod or Dispatcher::invoke<commit_after><?php
namespace Kir\Dispatching;

use Kir\Dispatching\Tools\MethodInvoker;

class Dispatcher {
	/**
	 * @var MethodInvoker
	 */
	private $invoker = null;

	/**
	 * @var InstanceFactory
	 */
	private $instanceFactory;

	/**
	 * @param InstanceFactory $instanceFactory
	 * @param MethodInvoker $invoker
	 */
	public function __construct(InstanceFactory $instanceFactory, MethodInvoker $invoker) {
		$this->invoker = $invoker;
		$this->instanceFactory = $instanceFactory;
	}

	/**
	 * @param string $className
	 * @return object
	 */
	public function createInstance($className) {
		return $this->instanceFactory->createInstance($className);
	}

	/**
	 * @param object $instance
	 * @param string $method
	 * @param array $params
	 * @throws \Exception
	 * @return mixed
	 */
	public function invokeMethod($instance, $method, array $params=array()) {
		return $this->invoker->invoke($instance, $method, $params);
	}

	/**
	 * @param string $className
	 * @param string $method
	 * @param array $params
	 * @throws Exceptions\BadInstanceFoundException
	 * @throws Exceptions\MethodNotFoundException
	 * @return mixed
	 */
	public function invoke($className, $method, array $params=array()) {
		$instance = $this->createInstance($className);
		return $this->invokeMethod($instance, $method, $params);
	}
}
{'fraction_non_alphanumeric': 0.13520502401182122, 'fraction_numerical': 0.0, 'mean_word_length': 4.481781376518219, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '4695495', 'n_tokens_mistral': 833, 'n_tokens_neox': 769, 'n_words': 193}