public static function Dump($var, $verbosityLevel = 0, $message = null, $level = 0) { $output = ''; if ($level == 0) { $display = false; } else { $display = true; //$output = ']['; } foreach ((array) $var as $i => $value) { if (is_array($value) or is_object($value)) { $output .= self::Dump($value, $verbosityLevel, $message, $level + 1); } else { if ($display === true) { LogCLI::MessageResult($message . LogCLI::GREEN . $i . LogCLI::RESET . ' = ' . LogCLI::YELLOW . $value . LogCLI::RESET, $verbosityLevel, LogCLI::INFO); } else { $output .= "[{$i} = {$value}]"; } } } return $output; }
public static function TraverseTree(array &$paths, $lookFor = 'defaults') { LogCLI::Message('Traversing definition tree in search for: ' . LogCLI::YELLOW . $lookFor . LogCLI::RESET, 6); $matches = array(); foreach (self::GetMultiDimentionalElements($paths) as $path) { //LogCLI::MessageResult('Element: '.LogCLI::BLUE.$path.LogCLI::RESET, 6, LogCLI::INFO); $pathElements = explode('/', $path); //$lastElement = end($pathElements); //if(stripos($path, $lookFor) !== FALSE) if (end($pathElements) == $lookFor) { LogCLI::MessageResult('Match found at: ' . LogCLI::BLUE . $path . LogCLI::RESET, 2, LogCLI::INFO); $matches[] = $path; /* this code is good, don't remove if(!is_object(self::accessArrayElementByPath($this->nginx, $fullpath))) { $last = StringTools::ReturnLastBit($fullpath); $fullpath = StringTools::DropLastBit($fullpath, 1); $fullpath = StringTools::AddBit($fullpath, $this->foreignDefinitions[$last]); LogCLI::MessageResult('Common config detected! Defined by: '.LogCLI::BLUE.$fullpath.LogCLI::RESET, 5, LogCLI::INFO); } */ } } LogCLI::Result(LogCLI::INFO); if (!empty($matches)) { return $matches; } else { return false; } }