public static function trace($backtrace = null, $options = array()) { if (is_null($backtrace)) { $backtrace = debug_backtrace(); } $backtrace = array_reverse($backtrace); $count = count($backtrace); $options += array('depth' => 50, 'start' => 0, 'output' => static::HTML); switch ($options['output']) { case static::RAW: $tpl = "%s(%s) from of %s#%d\n"; break; case static::CONSOLE: $tpl = "<info>%s(%s)</info> in %s @ <yellow>%d</yellow>\n"; break; default: $tpl = "<div style=\"" . static::HTML_STYLES . "\"><strong>%s<em>(%s)</em></strong><br/>in %s @ %d<br/><br/></div>"; } $trace = ""; $i = $options['start']; while ($i < $count && $i < $options['depth']) { $details = $backtrace[$i]; $file = isset($details['file']) ? str_replace(Strata::getRootPath(), '~', $details['file']) : 'unknown'; $line = isset($details['line']) ? $details['line'] : 'unknown'; $args = $details['args']; $arguments = array(); foreach ($args as $arg) { $arguments[] = static::getType($arg); } $trace .= sprintf($tpl, $details['function'], implode(", ", $arguments), $file, $line); $i++; } return $trace; }
/** * Gets the documentation's destination, either from an * argument passed as option or from the default path. * @return string Destination path. */ protected function getDestination() { if (!is_null($this->input->getOption('destination'))) { return $this->input->getOption('destination'); } return implode(DIRECTORY_SEPARATOR, array(Strata::getRootPath(), "doc", DIRECTORY_SEPARATOR)); }
?> </td> <?php } else { ?> <td class="code"> </td> <?php } ?> </tr> <?php } ?> </table> <div class="source"><?php echo str_replace(\Strata\Strata::getRootPath(), '~', $error['file']); ?> </div> <?php } ?> <?php } ?> <div class="trace"> <?php if (isset($error['trace'])) { ?> <div style="max-height: 300px;"> <h3><?php
/** * Saves extracted strings from the project to * locale mo and po files. */ private function saveStringToLocales() { $gettextEntries = $this->extractGettextStrings(); $root = Strata::getRootPath(); foreach ($gettextEntries as $translation) { $references = $translation->getReferences(); $translation->deleteReferences(); foreach ($references as $idx => $context) { $translation->addReference(str_replace($root, "~", $context[0]), $context[1]); } } foreach ($this->getLocales() as $locale) { $this->addGettextEntriesToLocale($locale, $gettextEntries); } }
/** * Confirms whether $filename exists at the base * of the project. * @return boolean */ private function hasIniFile($filename = "php.ini") { return file_exists(Strata::getRootPath() . DIRECTORY_SEPARATOR . $filename); }