<commit_before><?php

namespace Bazo\FeatureToggler\Diagnostics;


use Bazo\FeatureToggler\Toggler;
use Nette;
use Nette\Utils\Html;
use Tracy\Debugger;
use Tracy\IBarPanel;

/**
 * @author <NAME> <<EMAIL>>
 */
class Panel extends Nette\Object implements IBarPanel
{

	/**
	 * @var Toggler
	 */
	private $toggler;

	/** @var array */
	private $evaluatedFeatures = [];

	/**
	 * Renders HTML code for custom tab.
	 *
	 * @return string
	 */
	public function getTab()
	{
		$img = Html::el('img', ['height' => 16, 'width' => 16])
				->src('data:image/svg+xml;base64,' . base64_encode(file_get_contents(__DIR__ . '/logo.svg')));
		$tab = Html::el('span')->title('Features')->add($img);

		$features = $this->toggler->getFeatures();

		$title = Html::el()->setText(sprintf('Features (%d)', count($features)));


		return (string) $tab->add($title);
	}


	/**
	 * @return string
	 */
	public function getPanel()
	{
		if (empty($this->evaluatedFeatures)) {
			return NULL;
		}

		$evaluatedFeatures	 = $this->evaluatedFeatures;
		$click				 = class_exists('\Tracy\Dumper') ? function ($o, $c = TRUE, $d = 4) {
			return \Tracy\Dumper::toHtml($o, array('collapse' => $c, 'depth' => $d));
		} : callback('\Tracy\Helpers::clickableDump');
		ob_start();

		require __DIR__ . '/panel.phtml';

		return ob_get_clean();
	}


	/**
	 * @param Toggler $toggler
	 */
	public function register(Toggler $toggler)
	{<commit_msg>fix panel compatibility with nette 2.3<commit_after><?php

namespace Bazo\FeatureToggler\Diagnostics;


use Bazo\FeatureToggler\Toggler;
use Nette;
use Nette\Utils\Html;
use Tracy\Debugger;
use Tracy\IBarPanel;

/**
 * @author <NAME> <<EMAIL>>
 */
class Panel extends Nette\Object implements IBarPanel
{

	/**
	 * @var Toggler
	 */
	private $toggler;

	/** @var array */
	private $evaluatedFeatures = [];

	/**
	 * Renders HTML code for custom tab.
	 *
	 * @return string
	 */
	public function getTab()
	{
		$img = Html::el('img', ['height' => 16, 'width' => 16])
				->src('data:image/svg+xml;base64,' . base64_encode(file_get_contents(__DIR__ . '/logo.svg')));
		$tab = Html::el('span')->title('Features')->addHtml($img);

		$features = $this->toggler->getFeatures();

		$title = Html::el()->setText(sprintf('Features (%d)', count($features)));


		return (string) $tab->addHtml($title);
	}


	/**
	 * @return string
	 */
	public function getPanel()
	{
		if (empty($this->evaluatedFeatures)) {
			return NULL;
		}

		$evaluatedFeatures	 = $this->evaluatedFeatures;
		$click				 = class_exists('\Tracy\Dumper') ? function ($o, $c = TRUE, $d = 4) {
			return \Tracy\Dumper::toHtml($o, array('collapse' => $c, 'depth' => $d));
		} : callback('\Tracy\Helpers::clickableDump');
		ob_start();

		require __DIR__ . '/panel.phtml';

		return ob_get_clean();
	}


	/**
	 * @param Toggler $toggler
	 */
	public function register(Toggler $toggler)
	{
{'fraction_non_alphanumeric': 0.1926991926991927, 'fraction_numerical': 0.00702000702000702, 'mean_word_length': 3.888507718696398, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3425094', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1016, 'n_words': 205}