/** * Creates a string representation of this object * * @return string */ public function toString() { return sprintf("%s(%s)@{\n" . " [config ] %s\n" . " [scriptlet ] %s\n" . " [debug ] %s\n" . " [arguments ] [%s]\n" . " [environment ] %s\n" . "}", $this->getClassName(), $this->name, $this->config, $this->scriptlet, implode(' | ', WebDebug::namesOf($this->debug)), implode(', ', $this->arguments), xp::stringOf($this->environment, ' ')); }
/** * Creates a web application object from a given configuration section * * @param string profile * @param string application app name * @param string url * @return xp.scriptlet.WebApplication * @throws lang.IllegalStateException if the web is misconfigured */ protected function configuredApp($profile, $application, $url) { $section = 'app::' . $application; if (!$this->prop->hasSection($section)) { throw new IllegalStateException('Web misconfigured: Section ' . $section . ' mapped by ' . $url . ' missing'); } $app = new WebApplication($application); $app->setScriptlet($this->readString($profile, $section, 'class', '')); // Configuration base $app->setConfig($this->readString($profile, $section, 'prop-base', '{WEBROOT}/etc')); // Determine debug level $flags = WebDebug::NONE; foreach ($this->readArray($profile, $section, 'debug', array()) as $lvl) { $flags |= WebDebug::flagNamed($lvl); } $app->setDebug($flags); // Initialization arguments $app->setArguments($this->readArray($profile, $section, 'init-params', array())); // Environment $app->setEnvironment($this->readHash($profile, $section, 'init-envs', new Hashmap())->toArray()); return $app; }