Insphpect

This tool is currently proof-of-concept. Your feedback and evaluation is valuable in helping to improve it and ensure its reports are meaninful.

Please click here to complete a short survey to tell us what you think. It should take less than 5 minutes and help further this research project!

Transphporm\Hook\ElementData

Detected issues

Issue Method Line number

Code

Click highlighted lines for details

<?php/* @description     Transformation Style Sheets - Revolutionising PHP templating    * * @author          Tom Butler tom@r.je                                             * * @copyright       2017 Tom Butler <tom@r.je> | https://r.je/                      * * @license         http://www.opensource.org/licenses/bsd-license.php  BSD License * * @version         1.2                                                             */namespace Transphporm\Hook;/* Maps which data is applied to which element */class ElementData {	private $data;	private $elementMap;	public function __construct(\SplObjectStorage $elementMap, $data) {		$this->elementMap = $elementMap;		$this->data = $data;	}	/** Binds data to an element */	public function bind(\DomNode $element, $data, $type = 'data') {		$content = isset($this->elementMap[$element]) ? $this->elementMap[$element] : [];		$content[$type] = $data;		$this->elementMap[$element] = $content;	}	/** Returns the data that has been bound to $element, or, if no data is bound to $element climb the DOM tree to find the data bound to a parent node*/	public function getData(\DomElement $element = null, $type = 'data') {		while ($element) {			if (isset($this->elementMap[$element]) && array_key_exists($type, $this->elementMap[$element])) return $this->elementMap[$element][$type];			$element = $element->parentNode;		}		return $this->data;	}}