<commit_before><?php

namespace PhpPdg\Nodes;

use PHPCfg\Block;
use PhpPdg\Graph\NodeInterface;

class BlockNode implements NodeInterface {
	/** @var Block  */
	public $block;

	/**
	 * BlockNode constructor.
	 * @param Block $block
	 */
	public function __construct(Block $block) {
		$this->block = $block;
	}

	public function toString() {
		return $this->getHash();
	}

	public function getHash() {
		return 'BLOCK(' . spl_object_hash($this->block) . ')';
	}
}<commit_msg>added more info to block toString<commit_after><?php

namespace PhpPdg\Nodes;

use PHPCfg\Block;
use PHPCfg\Op;
use PhpPdg\Graph\NodeInterface;

class BlockNode implements NodeInterface {
	/** @var Block  */
	public $block;

	/**
	 * BlockNode constructor.
	 * @param Block $block
	 */
	public function __construct(Block $block) {
		$this->block = $block;
	}

	public function toString() {
		return sprintf('Block [%s]', implode(', ', array_map(function (Op $op) {
			$startLine = $op->getAttribute('startLine');
			$endLine = $op->getAttribute('endLine');
			$lines = $startLine === $endLine ? $startLine : $startLine . ':' . $endLine;
			return sprintf('Op %s @ line %s', str_replace("PHPCfg\\Op\\", '', get_class($op)), $lines);
		}, $this->block->children)));
	}

	public function getHash() {
		return 'BLOCK(' . spl_object_hash($this->block) . ')';
	}
}
{'fraction_non_alphanumeric': 0.1724137931034483, 'fraction_numerical': 0.0, 'mean_word_length': 4.095419847328245, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '4487998', 'n_tokens_mistral': 479, 'n_tokens_neox': 455, 'n_words': 105}