<commit_before><?php

/**
 *
 * This file is part of the Macdom
 *
 * Copyright (c) 2015-2017 <NAME>
 *
 * For the full copyright and license information, please view the file license.md
 * that was distributed with this source code.
 *
 */

declare(strict_types = 1);

namespace Macdom\Bridges\MacdomTracy;

use Macdom;
use Macdom\Token;
use Tracy\Debugger;
use Tracy\IBarPanel;


class MacdomPanel implements IBarPanel
{

	const TEMPLATES_DIR = __DIR__ . '/templates';

	/**
	 * @var Macdom\Engine
	 */
	private $macdom;

	public function __construct()
	{
		Debugger::getBar()->addPanel($this);
	}


	/**
	 * @return string
	 */
	public function getPanel()
	{
		ob_start();
		$installed = [
			'elements' => $this->getElements(),
			'macros' => $this->getMacros(),
			'elementsBooleanAttributes' => $this->macdom->getElementsBooleanAttributes(),
			'skipAreas' => $this->macdom->getSkipAreas()
		];
		require self::TEMPLATES_DIR . '/panel.phtml';

		return ob_get_clean();
	}


	/**
	 * @return string|void
	 */
	public function getTab()
	{
		if (headers_sent() && ! session_id()) {
			return;
		}

		ob_start();
		require self::TEMPLATES_DIR . '/tab.phtml';

		return ob_get_clean();
	}


	public function setMacdom(Macdom\Engine $macdom): self
	{
		$this->macdom = $macdom;

		return $this;
	}


	private function getElements(): array<commit_msg>- v3.0 - Updated MacdomTracy/MacdomPanel - fixed cs<commit_after><?php

/**
 *
 * This file is part of the Macdom
 *
 * Copyright (c) 2015-2017 <NAME>
 *
 * For the full copyright and license information, please view the file license.md
 * that was distributed with this source code.
 *
 */

declare(strict_types = 1);

namespace Macdom\Bridges\MacdomTracy;

use Macdom;
use Macdom\Engine;
use Macdom\Token;
use Tracy\Debugger;
use Tracy\IBarPanel;


class MacdomPanel implements IBarPanel
{

	const TEMPLATES_DIR = __DIR__ . '/templates';

	/**
	 * @var Engine
	 */
	private $macdom;


	public function __construct()
	{
		Debugger::getBar()->addPanel($this);
	}


	/**
	 * @return string
	 */
	public function getPanel()
	{
		ob_start();

		$installed = [
			'elements' => $this->getElements(),
			'macros' => $this->getMacros(),
			'elementsBooleanAttributes' => $this->macdom->getElementsBooleanAttributes(),
		];

		require self::TEMPLATES_DIR . '/panel.phtml';

		return ob_get_clean();
	}


	/**
	 * @return string|void
	 */
	public function getTab()
	{
		if (headers_sent() && ! session_id()) {
			return;
		}

		ob_start();

		require self::TEMPLATES_DIR . '/tab.phtml';

		return ob_get_clean();
	}


	public function setMacdom(Engine $macdom): self
	{
		$this->macdom = $macdom;

		return $this;
	}


	private function getElements(): array
{'fraction_non_alphanumeric': 0.1459799925898481, 'fraction_numerical': 0.007410151908114116, 'mean_word_length': 3.6391752577319587, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6187957', 'n_tokens_mistral': 1028, 'n_tokens_neox': 906, 'n_words': 218}