Debugging function to inspect the node tree
@return void
762914
function dump( Lex $Lex, $tab = '' ){
		$tag = $Lex->name( $this->t );
		if( $this->is_terminal() ){
			if( $this->value && $this->value !== $this->t ){
				echo $tab, '<',$tag,">\n   ", $tab, htmlspecialchars($this->value),"\n",$tab,'</',$tag,">\n";
			}
			else {
				echo $tab, htmlspecialchars($this->value),"\n";
			}
		}
		else if( ! $this->length ){
			echo $tab, '<', $tag, " />\n";
		}
		else {
			echo $tab, '<',$tag,">\n";
			foreach( $this->children as $Child ){
				$Child->dump( $Lex, "   ".$tab);
			}
			echo $tab, '</', $tag, ">\n";
		}
	}
739312
public function debugDumpParams()
    {
        $str  = "SQL: [".strlen($this->_statement)."] ".$this->_statement."\n";
        $str .= "Params: ".sizeof($this->_binds)."\n";
        foreach ($this->_binds as $key => $value) {
            $str .= "Key: Name: [".strlen($key)."] $key\n";
            $str .= "name=[".strlen($key)."] \"$key\"\n";
            $str .= "is_param=1\n";
        }
        echo substr($str, 0, strlen($str)-1);
    }
1016148
public function debug() {
        echo "filePath    = " . $this->filePath . PHP_EOL;
        echo "startMarker = " . $this->startMarker . PHP_EOL;
        echo "endMarker   = " . $this->endMarker . PHP_EOL;
        echo "startIndex  = " . $this->startIndex . PHP_EOL;
        echo "endIndex    = " . $this->endIndex . PHP_EOL;
        echo "numLines    = " . $this->numLines . PHP_EOL;
        echo "Start       = " . print_r($this->beforeLines, true);
        echo "Auto      = " . print_r($this->autoLines, true);
        echo "End         = " . print_r($this->afterLines, true);
        return $this;
    }
356163
protected function getRootTreeData()
    {
        return [
            'id' => '0',
            'parent' => '#',
            'text' => $this->treeLabels['top_level_tags'],
            'children' => true,
            'state' => [
                'opened' => true,
            ],
            'a_attr' => [
                'href' => $this->treeLinks['top_level_tags'],
                'rel' => '0',
            ],
            'data' => [
                'context_menu' => [
                    [
                        'name' => 'add_child',
                        'url' => str_replace(':parentId', 0, $this->treeLinks['add_child']),
                        'text' => $this->treeLabels['add_child'],
                    ],
                ],
            ],
        ];
    }
812028
public function ___debugInfo()
    {
        return array(
            'name'  => isset($this->propertyNode) ? $this->propertyNode->name->toString() : 'unknown',
            'class' => $this->className
        );
    }
336452
public function display()
    {
        if (!$this->visible) {
            return;
        }

        SwatWidget::display();

        // tree is copied for display so we can add a blank node if show_blank
        // is true
        $display_tree = $this->getDisplayTree();
        $count = count($display_tree) - 1;

        // only show a select if there is more than one option
        if ($count > 1) {
            $select_tag = new SwatHtmlTag('select');
            $select_tag->name = $this->id;
            $select_tag->id = $this->id;
            $select_tag->class = $this->getCSSClassString();

            if (!$this->isSensitive()) {
                $select_tag->disabled = 'disabled';
            }

            $select_tag->open();

            foreach ($display_tree->getChildren() as $child) {
                $this->displayNode($child, 1);
            }

            $select_tag->close();
        } elseif ($count === 1) {
            // get first and only element
            $children = $display_tree->getChildren();
            $option = reset($children)->getOption();
            $this->displaySingle($option);
        }
    }
730497
private function render()
    {
        echo '
            <style>
            .debugger small {
                border: 1px solid rgba(0,0,0,0.2); 
                opacity: 0.5; 
                padding: 2px 5px; 
                margin-left: 5px; 
                border-radius: 2px;
            }
            </style>';

        echo '<pre class="debugger"><strong>@debug</strong><br>';

        foreach ($this->data as $index => $controller) {
            // Set the class params for each Controller
            $this->controller = $controller;

            // Echo the Controller class name
            echo $controller->class;

            // Echo extends tree if the Controller implements tree
            if ($controller->tree) {
                echo '<small>extends tree</small>';
            }

            echo '<ul>';

            // Render data
            if ($controller->data) {
                $this->renderData();
            }

            // Render methods
            if ($controller->methods) {
                $this->renderMethods();
            }

            echo '</ul>';
        }

        echo '</pre>';
    }
994199
protected function renderTree()
    {
        $lines = [];

        $tag = ArrayHelper::remove($this->options, 'tag', 'div');
        $lines[] = Html::beginTag($tag, $this->options);

        $lines[] = $this->renderToolbar();
        $lines[] = $this->renderNodes($this->nodes);

        $lines[] = Html::endTag($tag);

        return implode("\n", $lines);
    }
917941
public function _displayTree($tree, $parent = NULL)
    {
        $outputList = TRUE;
        foreach ($tree as $name => $element) {
            if ($element->superclass() == $parent) {
                if ($outputList) echo "<ul>\n";
                echo '<li><a href="', str_repeat('../', $this->_depth), $element->asPath(), '">', $element->qualifiedName(), '</a>';
                $this->_displayTree($tree, $name);
                echo "</li>\n";
                $outputList = FALSE;
            }
        }
        if (!$outputList) echo "</ul>\n";
    }
1292869
public function index() {
        $wt_tree = Globals::getTree();
        Theme::theme(new AdministrationTheme)->init($wt_tree);
        $controller = new PageController();
        $controller
            ->restrictAccess(Auth::isManager($wt_tree))
            ->setPageTitle($this->module->getTitle());
        
        $data = new ViewBag();
        $data->set('title', $controller->getPageTitle());
        $data->set('tree', $wt_tree);
        
        $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig');
                
        $table_id = 'table-geoanalysis-' . Uuid::uuid4();
        $data->set('table_id', $table_id);
        
        $other_trees = array();
        foreach (Tree::getAll() as $tree) {
            if($tree->getTreeId() != $wt_tree->getTreeId()) $other_trees[] = $tree;
        }      
        $data->set('other_trees', $other_trees);
        
        $data->set('places_hierarchy', $this->provider->getPlacesHierarchy());
        
        $controller
            ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)
            ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)
            ->addInlineJavascript('
				jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc;
				jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc;
                
				var geoAnalysisTable = jQuery("#'.$table_id.'")
                .on("draw.dt", function ( e, settings, json, xhr ) {
                    jQuery("[data-toggle=\'tooltip\']").tooltip();
                }).DataTable({
					'.I18N::datatablesI18N().',			
					sorting: [[3, "asc"], [4, "asc"]],
					pageLength: 10,
                    processing: true,
                    serverSide : true,
					ajax : {
						url : "module.php?mod='.$this->module->getName().'&mod_action=AdminConfig@jsonGeoAnalysisList&ged='. $wt_tree->getNameUrl().'",
                        type : "POST"
					},
                    columns: [
						/* 0 Edit		 	*/ { sortable: false, className: "text-center"},
                        /* 1 ID             */ { sortable: false, visible: false},
						/* 2 Enabled 		*/ { sortable: false, className: "text-center"  },
						/* 3 Description	*/ { type: "text" },
						/* 4 Analysis Level	*/ { type: "text", dataSort: 5, className: "text-center" },
						/* 5 ANAL_LEVEL_SORT*/ { type: "num", visible: false },
						/* 6 Map 	        */ { type: "text", sortable: false, className: "text-center" },
						/* 7 Map Top Level 	*/ { type: "text", sortable: false, className: "text-center" },
						/* 8 Use Flags     	*/ { type: "text", sortable: false, className: "text-center" },					
						/* 9 Place Details	*/ { type: "text", sortable: false, className: "text-center" }
					],
				});
                
                ')
                ->addInlineJavascript('				
                    function set_geoanalysis_status(ga_id, status, gedcom) {
                		jQuery.ajax({
                            url: "module.php", 
                            type: "GET",
                            data: {
                			    mod: "' . $this->module->getName() .'",
                                mod_action:  "GeoAnalysis@setStatus",
                			    ga_id: ga_id,
                			    ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom,
                                status: status
                            },
                            error: function(result, stat, error) {
                                var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error;
                                alert("' . I18N::translate('An error occured while editing this analysis:') . '" + err);
                            },
                            complete: function(result, stat) {
                                geoAnalysisTable.ajax.reload(null, false);
                            }                            
                		});
                    }
                    
                    function delete_geoanalysis(ga_id, status, gedcom) {
                		jQuery.ajax({
                            url: "module.php", 
                            type: "GET",
                            data: {
                			    mod: "' . $this->module->getName() .'",
                                mod_action:  "GeoAnalysis@delete",
                			    ga_id: ga_id,
                			    ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom
                            },
                            error: function(result, stat, error) {
                                var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error;
                                alert("' . I18N::translate('An error occured while deleting this analysis:') . '" + err);
                            },
                            complete: function(result, stat) {
                                geoAnalysisTable.ajax.reload(null, false);
                            }                            
                		});
                    }
                ');
        
        
        ViewFactory::make('AdminConfig', $this, $controller, $data)->render();
    }
1106644
public function showMappingCommand(): void
    {
        $nodeTypeMappingCollection = $this->nodeTypeMappingBuilder->buildMappingInformation($this->nodeIndexer->getIndex());
        foreach ($nodeTypeMappingCollection as $mapping) {
            /** @var Mapping $mapping */
            $this->output(Yaml::dump($mapping->asArray(), 5, 2));
            $this->outputLine();
        }
        $this->outputLine('------------');

        $mappingErrors = $this->nodeTypeMappingBuilder->getLastMappingErrors();
        if ($mappingErrors->hasErrors()) {
            $this->outputLine('<b>Mapping Errors</b>');
            foreach ($mappingErrors->getFlattenedErrors() as $errors) {
                foreach ($errors as $error) {
                    $this->outputLine($error);
                }
            }
        }

        if ($mappingErrors->hasWarnings()) {
            $this->outputLine('<b>Mapping Warnings</b>');
            foreach ($mappingErrors->getFlattenedWarnings() as $warnings) {
                foreach ($warnings as $warning) {
                    $this->outputLine($warning);
                }
            }
        }
    }
1039973
public function debug()
    {
        if (!is_array($this->required)) {
            return false;
        }

        $result = "<ul>";
        foreach ($this->required as $name) {
            $result .= "<li>$name</li>";
        }

        $result .= "</ul>";
        return $result;
    }
6717
public function logDebug()
  {
    if ($this->getVerbosity()>=OutputInterface::VERBOSITY_DEBUG)
    {
      $args   = func_get_args();
      $format = array_shift($args);

      $this->writeln(vsprintf('<info>'.$format.'</info>', $args));
    }
  }
65623
private function traverse($currentNode)
    {
        $this->collectDiagnostics($currentNode);

        // Only update/descend into Nodes, Tokens are leaves
        if ($currentNode instanceof Node) {
            $this->collectDefinitionsAndReferences($currentNode);

            foreach ($currentNode::CHILD_NAMES as $name) {
                $child = $currentNode->$name;

                if ($child === null) {
                    continue;
                }

                if (\is_array($child)) {
                    foreach ($child as $actualChild) {
                        if ($actualChild !== null) {
                            $this->traverse($actualChild);
                        }
                    }
                } else {
                    $this->traverse($child);
                }
            }
        }
    }
709530
function inspectNode(node) {
            if (!node) {
                return "[No node]";
            }
            if (crashyTextNodes && isBrokenNode(node)) {
                return "[Broken node]";
            }
            if (isCharacterDataNode(node)) {
                return '"' + node.data + '"';
            }
            if (node.nodeType == 1) {
                var idAttr = node.id ? ' id="' + node.id + '"' : "";
                return "<" + node.nodeName + idAttr + ">[index:" + getNodeIndex(node) + ",length:" + node.childNodes.length + "][" + (node.innerHTML || "[innerHTML not supported]").slice(0, 25) + "]";
            }
            return node.nodeName;
        }
639647
function _displayTree($tree, $parent = NULL) {
        $outputList = TRUE;
        foreach ($tree as $name => $element) {
            if ($element->superclass() == $parent) {
                if ($outputList)
                    echo "<ul>\n";
                echo "<li><a href=\"", $this->_asURL($element), "\">", $element->qualifiedName(), "</a>";
                $this->_displayTree($tree, $name);
                echo "</li>\n";
                $outputList = FALSE;
            }
        }
        if (!$outputList)
            echo "</ul>\n";
    }
1312250
public function drawTree()
	{
		$searchCondition = $this->createSearchCondition();
		$orderRule = $this->createSelectOrderRule()
				->byLeftAscending();
		$nodes = $this->search($searchCondition, $orderRule);
		$output = Node\NodeAbstraction::output($nodes);
		
		return $output;
	}