Compute parents of the tokens to easily determine containing methods and classes.

@param bool $debug
331110
private function computeNestingParentTokens($debug = false) {
		$nesting = 0;
		$parents = array();
		$lastParent = null;
		foreach ($this->tokens as $key => $token) {
			if (is_array($token)) {
				//add info about parent to array
				$parent = $parents ? $parents[count($parents)-1] : null;
				$this->tokens[$key][3] = $parent;
				$this->tokens[$key][4] = $nesting;

				//is current token possible parent in current level?
				if ($this->isEqualToAnyToken(array(T_CLASS, T_INTERFACE, T_FUNCTION), $key)) {
					$lastParent = $key + 2;
				} elseif ($this->isEqualToAnyToken(array(T_CURLY_OPEN, T_DOLLAR_OPEN_CURLY_BRACES), $key)) {
					$nesting++;
					array_push($parents, '');//just a placeholder
					if ($debug) {
						echo "$nesting\{\$\n";
					}
				}
			} else {
				if ($token == '{') {
					$nesting++;
					if ($debug) {
						echo "$nesting{\n";
					}
					array_push($parents, $lastParent);
				} elseif ($token == '}') {
					if ($debug) {
						echo "$nesting}\n";
					}
					$nesting--;
					array_pop($parents);
				}
			}
		}
	}
1161950
public function my_setDebug($node_name, $bool)
    {
        if ($node_name == getNodeName()) {
            Start::setDebug($bool);
        } else {
            if (array_key_exists($node_name, $this->client)) {
                $this->client[$node_name]->setDebug($bool);
            }
        }
    }
1240490
public function set_debug($dbg = true)
    {
        $this->options['debug'] = $dbg;
        $this->conn->setDebug($dbg, array($this, 'debug_handler'));
    }
453254
public function setDebug($debug)
    {
        if ($this->handler) {
            throw new AlreadyBuildedException('The handler already builded.');
        }

        $this->debug = (bool) $debug;

        return $this;
    }
641079
public function deployCommand($debug = false)
    {
        $this->outputLine('<b>Run deploy hook commands</b>');
        $this->commandService->executeHooks($this->deployHooks, function (...$args) { $this->outputLine(...$args); } );
    }
246397
public function setDebug($debug)
    {
        //====================================================================//
        // Change Parameter State
        $this->debug = $debug;
        //====================================================================//
        // Delete Existing Debug Messages
        if ((0 == $debug) && isset($this->debug)) {
            $this->deb = array();
        }

        return true;
    }
349016
public function display_debug($obj, $full = false)
    {
        if (!$full) {
            $this->offset ++;
            $savedIndex = $this->index;
            $this->index = 9999;
        }
        if ($obj->_objType == 1) {
            $smarty = $obj;
        } else {
            $smarty = $obj->smarty;
        }
        // create fresh instance of smarty for displaying the debug console
        // to avoid problems if the application did overload the Smarty class
        $debObj = new Smarty();
        // copy the working dirs from application
        $debObj->setCompileDir($smarty->getCompileDir());
        // init properties by hand as user may have edited the original Smarty class
        $debObj->setPluginsDir(is_dir(__DIR__ . '/../plugins') ? __DIR__ . '/../plugins' : $smarty->getPluginsDir());
        $debObj->force_compile = false;
        $debObj->compile_check = true;
        $debObj->left_delimiter = '{';
        $debObj->right_delimiter = '}';
        $debObj->security_policy = null;
        $debObj->debugging = false;
        $debObj->debugging_ctrl = 'NONE';
        $debObj->error_reporting = E_ALL & ~E_NOTICE;
        $debObj->debug_tpl = isset($smarty->debug_tpl) ? $smarty->debug_tpl : 'file:' . __DIR__ . '/../debug.tpl';
        $debObj->registered_plugins = array();
        $debObj->registered_resources = array();
        $debObj->registered_filters = array();
        $debObj->autoload_filters = array();
        $debObj->default_modifiers = array();
        $debObj->escape_html = true;
        $debObj->caching = false;
        $debObj->compile_id = null;
        $debObj->cache_id = null;
        // prepare information of assigned variables
        $ptr = $this->get_debug_vars($obj);
        $_assigned_vars = $ptr->tpl_vars;
        ksort($_assigned_vars);
        $_config_vars = $ptr->config_vars;
        ksort($_config_vars);
        $debugging = $smarty->debugging;

        $_template = new Smarty_Internal_Template($debObj->debug_tpl, $debObj);
        if ($obj->_objType == 2) {
            $_template->assign('template_name', $obj->source->type . ':' . $obj->source->name);
        }
        if ($obj->_objType == 1 || $full) {
            $_template->assign('template_data', $this->template_data[$this->index]);
        } else {
            $_template->assign('template_data', null);
        }
        $_template->assign('assigned_vars', $_assigned_vars);
        $_template->assign('config_vars', $_config_vars);
        $_template->assign('execution_time', microtime(true) - $smarty->start_time);
        $_template->assign('display_mode', $debugging == 2 || !$full);
        $_template->assign('offset', $this->offset * 50);
        echo $_template->fetch();
        if (isset($full)) {
            $this->index --;
        }
        if (!$full) {
            $this->index = $savedIndex;
        }
    }
438946
public function debug()
    {
        $info = array();

        $metadata = $this->getMetadata();

        $referenceFields = array();
        foreach (array_merge($metadata['referencesOne'], $metadata['referencesMany']) as $name => $reference) {
            $referenceFields[] = $reference['field'];
        }

        // fields
        foreach ($metadata['fields'] as $name => $field) {
            if (in_array($name, $referenceFields)) {
                continue;
            }
            $info['fields'][$name] = $this->{'get'.ucfirst($name)}();
        }

        // referencesOne
        foreach ($metadata['referencesOne'] as $name => $referenceOne) {
            $info['referencesOne'][$name] = $this->{'get'.ucfirst($referenceOne['field'])}();
        }

        // referencesMany
        foreach ($metadata['referencesMany'] as $name => $referenceMany) {
            $info['referencesMany'][$name] = $this->{'get'.ucfirst($referenceMany['field'])}();
        }

        // embeddedsOne
        foreach ($metadata['embeddedsOne'] as $name => $embeddedOne) {
            $embedded = $this->{'get'.ucfirst($name)}();
            $info['embeddedsOne'][$name] = $embedded ? $embedded->debug() : null;
        }

        // embeddedsMany
        foreach ($metadata['embeddedsMany'] as $name => $embeddedMany) {
            $info['embeddedsMany'][$name] = array();
            foreach ($this->{'get'.ucfirst($name)}() as $key => $value) {
                $info['embeddedsMany'][$name][$key] = $value->debug();
            }
        }

        return $info;
    }
602181
final public function setDebug($callback = true)
    {
        if ($callback === true) {
            if (php_sapi_name() === 'cli') {
                $callback = new DebuggerOutConsole();
            } else {
                $callback = new DebuggerOutHtml();
            }
        }
        $this->debugCallback = $callback;
    }
1352096
public static function debug($msg)
    {
        if ($msg === 'open' || $msg === 'close') {
            self::$_debugOpen = $msg === 'open';
        } elseif (self::$_debugOpen === true) {
            $key = self::$_processKey === null ? '' : '[' . self::$_processKey . '] ';
            echo '[DEBUG] ', date('H:i:s '), $key, implode('', func_get_args()), self::CRLF;
        }
    }
1309544
protected function _processMethods($parent)
    {
        foreach ($parent->tree as $child) {
            if (!$child->processable) {
                continue;
            }
            $process = (
                $child->type === 'function' &&
                $child->isMethod &&
                !isset($child->visibility['abstract'])
            );
            if ($process) {
                $code = $this->_classes['node'];
                $before = new $code($this->_before($child->isGenerator, $child->isVoid), 'code');
                $before->parent = $child;
                $before->function = $child;
                $before->processable = false;
                $before->namespace = $child->namespace;
                array_unshift($child->tree, $before);
            }
        }
    }
1013252
public static function display_debugging_messages($return = false) {
        if (empty(self::$debuggings)) {
            return false;
        }

        $debugstring = '';
        foreach(self::$debuggings as $debug) {
            $debugstring .= 'Debugging: ' . $debug->message . "\n" . trim($debug->from) . "\n";
        }

        if ($return) {
            return $debugstring;
        }
        echo $debugstring;
        return true;
    }
137084
private function debugDB(PDO $pdo): void
    {
        $debugDB = new TraceablePDO($pdo);
        Container::$app->get('debugbar')->addCollector(new PDOCollector($debugDB));
    }
108348
public function setCurlDebugging($debug = true) {
        $this->options['debug'] = $debug;

        $this->guzzle = $this->createGuzzleClient();
    }
780066
protected function debugHeaders(&$headers)
    {
        if (!$this->debug->getCfg('collect')) {
            return;
        }
        $eol = "\r\n";
        $strDebug = '';
        foreach ($headers as $k => $v) {
            if (in_array($k, array('Attachments', 'Body'))) {
                continue;
            }
            if (empty($v)) {
                continue;
            }
            $strDebug .= '<u>'.$k.'</u>: '.htmlspecialchars($v).$eol;
        }
        $strDebug .= $eol.htmlspecialchars(
            preg_replace('/(Content-Transfer-Encoding:\s+base64'.$eol.$eol.').+'.$eol.$eol.'/s', '$1removed for debug output'.$eol.$eol, $headers['Body'])
        );
        $this->debug->log(
            'Email:<br />'
            .'<pre style="margin-left:2em; padding:.25em; border:#999 solid 1px; background-color:#DDD; color:#000;">'
            .$strDebug
            .'</pre>'
        );
    }
1328398
public static function getInstance($lang, $debug = false)
	{
		if (!isset(self::$languages[$lang . $debug]))
		{
			$language = new self($lang, $debug);

			self::$languages[$lang . $debug] = $language;

			// Check if Language was instantiated with a null $lang param;
			// if so, retrieve the language code from the object and store
			// the instance with the language code as well
			if (is_null($lang))
			{
				self::$languages[$language->getLanguage() . $debug] = $language;
			}
		}

		return self::$languages[$lang . $debug];
	}
500357
public function load($bDebug = false, $sOtherPortail = null)
	{
		$sQuery = $this->_prepare();

		if ($bDebug === true) { echo $sQuery;  }

		$aResults = self::connect()->query($sQuery)->fetchAll(\PDO::FETCH_ASSOC);
		$aReturn = array();
		$i = 0;

		foreach ($aResults as $mKey => $aOneResult) {

			if (isset($aOneResult['.FOUND_ROWS()'])) {

				return $aOneResult['.FOUND_ROWS()'];
			}
			else {

				if ($this->_sFromAs) { $sPrefix = $this->_sFromAs.'.'; }
				else { $sPrefix = ''; }

				$aReturn[$i] = Entity::autoLoadEntity($this->_sFrom, $aOneResult, $sPrefix, true, $sOtherPortail);

				foreach ($this->_aJoin as $aJoin) {

					if (count($aJoin) > 0) {

						if ($aJoin['as']) { $sPrefixJoin = $aJoin['as'].'.'; }
						else { $sPrefixJoin = ''; }
 
						$sPropertieName = 'get_'.$aJoin['table'];

						if (method_exists($aReturn[$i], $sPropertieName)) {
						    
						    $sPropertieName = $aJoin['table'].'2';
						    $aReturn[$i]->$sPropertieName = Entity::autoLoadEntity($aJoin['table'], $aOneResult, $sPrefixJoin, true, $sOtherPortail);
						}
						else {
						
						    $aReturn[$i]->$aJoin['table'] = Entity::autoLoadEntity($aJoin['table'], $aOneResult, $sPrefixJoin, true, $sOtherPortail);
						}
					}
				} 

				$i++;
			}
		}

		$this->flush();

		if ($this->_mWhere instanceof Where) { $this->_mWhere->flush(); }

		/**
		 * Trigger on a model to initialize it every time you load each entity
		 */
		if (isset($aReturn[0]) && method_exists($aReturn[0], 'afterFetch')) {
		    
		    foreach ($aReturn as $iKey => $oOne) {
		    
		        $aReturn[$iKey]::afterFetch();
		    }
		}
		
		return $aReturn;
	}