<commit_before><?php
/*
 * Spectrum
 *
 * Copyright (c) 2011 <NAME> <<EMAIL>>
 * All rights reserved.
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 */

namespace net\mkharitonov\spectrum\reports\widgets\runResultsBuffer\details;
use \net\mkharitonov\spectrum\core\asserts\MatcherCallDetailsInterface;

/**
 * @author <NAME> <<EMAIL>>
 * @link   http://www.mkharitonov.net/spectrum/
 */
class MatcherCall extends Details
{
	public function getStyles()
	{
		return
			parent::getStyles() . $this->getNewline() .
			'<style type="text/css">' . $this->getNewline() .
				$this->getIndention() . '.g-runResultsBuffer-details-matcherCall>.matcherCall { margin-bottom: 4px; }' . $this->getNewline() .
				$this->getIndention() . '.g-runResultsBuffer-details-matcherCall>div>.title { font-weight: bold; }' . $this->getNewline() .
			'</style>' . $this->getNewline();
	}

	public function getHtml(MatcherCallDetailsInterface $details)
	{
		$output = '';
		$output .= '<div class="g-runResultsBuffer-details g-runResultsBuffer-details-matcherCall">';
		$output .= $this->getHtmlForMatcherCall($details);
		$output .= '<div class="returnValue"><span class="title" title="Matcher return value">Return:</span> ' . $this->codeWidget->getHtmlForVariable($details->getMatcherReturnValue()) . '</div>';
		$output .= '<div class="thrownException"><span class="title" title="Matcher thrown exception">Thrown:</span> ' . $this->codeWidget->getHtmlForVariable($details->getException()) . '</div>';
		$output .= '</div>';
		return $output;
	}

	protected function getHtmlForMatcherCall(MatcherCallDetailsInterface $details)
	{
		$output = '';

		$output .= '<div class="matcherCall">';
		$output .= $this->codeWidget->getHtmlForMethod('be', array($details->getActualValue()));

		if ($details->getIsNot())
		{
			$output .= $this->codeWidget->getHtmlForOperator('->');
			$output .= $this->codeWidget->getHtmlForPropertyAccess('not');
		}

		$output .= $this->codeWidget->getHtmlForOperator('->');
		$output .= $this->codeWidget->getHtmlForMethod($details->getMatcherName(), $details->getMatcherArgs());
		$output .= '</div>';

		return $output;
	}
}<commit_msg>Subsystem "reports\widgets\runResultsBuffer": added bold for "be/eq", feractored "details\MatcherCall"<commit_after><?php
/*
 * Spectrum
 *
 * Copyright (c) 2011 <NAME> <<EMAIL>>
 * All rights reserved.
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 */

namespace net\mkharitonov\spectrum\reports\widgets\runResultsBuffer\details;
use \net\mkharitonov\spectrum\core\asserts\MatcherCallDetailsInterface;

/**
 * @author <NAME> <<EMAIL>>
 * @link   http://www.mkharitonov.net/spectrum/
 */
class MatcherCall extends Details
{
	public function getStyles()
	{
		return
			parent::getStyles() . $this->getNewline() .
			'<style type="text/css">' . $this->getNewline() .
				$this->getIndention() . '.g-runResultsBuffer-details-matcherCall>.callExpression { margin-bottom: 4px; }' . $this->getNewline() .
				$this->getIndention() . '.g-runResultsBuffer-details-matcherCall>.callExpression>.g-code-method>.methodName { font-weight: bold; }' . $this->getNewline() .
				$this->getIndention() . '.g-runResultsBuffer-details-matcherCall>div>.title { font-weight: bold; }' . $this->getNewline() .
			'</style>' . $this->getNewline();
	}

	public function getHtml(MatcherCallDetailsInterface $details)
	{
		$output = '';
		$output .= '<div class="g-runResultsBuffer-details g-runResultsBuffer-details-matcherCall">';
		$output .= $this->getHtmlForCallExpression($details);
		$output .= '<div class="returnValue"><span class="title" title="Matcher return value">Return:</span> ' . $this->codeWidget->getHtmlForVariable($details->getMatcherReturnValue()) . '</div>';
		$output .= '<div class="thrownException"><span class="title" title="Matcher thrown exception">Thrown:</span> ' . $this->codeWidget->getHtmlForVariable($details->getException()) . '</div>';
		$output .= '</div>';
		return $output;
	}

	protected function getHtmlForCallExpression(MatcherCallDetailsInterface $details)
	{
		$output = '';

		$output .= '<div class="callExpression">';
		$output .= $this->codeWidget->getHtmlForMethod('be', array($details->getActualValue()));

		if ($details->getIsNot())
		{
			$output .= $this->codeWidget->getHtmlForOperator('->');
			$output .= $this->codeWidget->getHtmlForPropertyAccess('not');
		}

		$output .= $this->codeWidget->getHtmlForOperator('->');
		$output .= $this->codeWidget->getHtmlForMethod($details->getMatcherName(), $details->getMatcherArgs());
		$output .= '</div>';

		return $output;
	}
}
{'fraction_non_alphanumeric': 0.18767327788441032, 'fraction_numerical': 0.0021326508850501172, 'mean_word_length': 4.884567126725219, 'pattern_counts': {'":': 1, '<': 45, '<?xml version=': 0, '>': 114, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4823601', 'n_tokens_mistral': 1559, 'n_tokens_neox': 1448, 'n_words': 258}