protected static function _definition($reference, $callLine) {
		if (file_exists($reference)) {
			foreach (array_reverse(token_get_all(file_get_contents($reference))) as $token) {
				if (!is_array($token) || $token[2] > $callLine) {
					continue;
				}
				if ($token[0] === T_FUNCTION) {
					return $token[2];
				}
			}
			return;
		}
		list($class,) = explode('::', $reference);

		if (!class_exists($class)) {
			return;
		}

		$classRef = new ReflectionClass($class);
		$methodInfo = Inspector::info($reference);
		$methodDef = join("\n", Inspector::lines($classRef->getFileName(), range(
			$methodInfo['start'] + 1, $methodInfo['end'] - 1
		)));

		foreach (array_reverse(token_get_all("<?php {$methodDef} ?>")) as $token) {
			if (!is_array($token) || $token[2] > $callLine) {
				continue;
			}
			if ($token[0] === T_FUNCTION) {
				return $token[2] + $methodInfo['start'];
			}
		}
	}
protected static function _definition($reference, $callLine) {
		if (file_exists($reference)) {
			foreach (array_reverse(token_get_all(file_get_contents($reference))) as $token) {
				if (!is_array($token) || $token[2] > $callLine) {
					continue;
				}
				if ($token[0] === T_FUNCTION) {
					return $token[2];
				}
			}
			return;
		}
		list($class,) = explode('::', $reference);

		if (!class_exists($class)) {
			return;
		}

		$classRef = new ReflectionClass($class);
		$methodInfo = Inspector::info($reference);
		$methodDef = join("\n", Inspector::lines($classRef->getFileName(), range(
			$methodInfo['start'] + 1, $methodInfo['end'] - 1
		)));

		foreach (array_reverse(token_get_all("<?php {$methodDef} ?>")) as $token) {
			if (!is_array($token) || $token[2] > $callLine) {
				continue;
			}
			if ($token[0] === T_FUNCTION) {
				return $token[2] + $methodInfo['start'];
			}
		}
	}
protected static function _definition ( $ reference , $ callLine ) { if ( file_exists ( $ reference ) ) { foreach ( array_reverse ( token_get_all ( file_get_contents ( $ reference ) ) ) as $ token ) { if ( ! is_array ( $ token ) || $ token [ 2 ] > $ callLine ) { continue ; } if ( $ token [ 0 ] === T_FUNCTION ) { return $ token [ 2 ] ; } } return ; } list ( $ class , ) = explode ( '::' , $ reference ) ; if ( ! class_exists ( $ class ) ) { return ; } $ classRef = new ReflectionClass ( $ class ) ; $ methodInfo = Inspector :: info ( $ reference ) ; $ methodDef = join ( "\n" , Inspector :: lines ( $ classRef -> getFileName ( ) , range ( $ methodInfo [ 'start' ] + 1 , $ methodInfo [ 'end' ] - 1 ) ) ) ; foreach ( array_reverse ( token_get_all ( "<?php {$methodDef} ?>" ) ) as $ token ) { if ( ! is_array ( $ token ) || $ token [ 2 ] > $ callLine ) { continue ; } if ( $ token [ 0 ] === T_FUNCTION ) { return $ token [ 2 ] + $ methodInfo [ 'start' ] ; } } }
Locates original location of closures.

@param mixed $reference File or class name to inspect.
@param integer $callLine Line number of class reference.
@return mixed Returns the line number where the method called is defined.
Locates original location of closures .