protected function expand($class, $reflection, $descriptor) { if (is_array($this->values[0])) { $this->httpMethods = $this->values[0]; } else { $this->httpMethods = array($this->values[0]); } if (isset($this->values[1])) { $this->path = $this->values[1]; } $controller = Library::getFullyQualifiedClassName($class); $controllerMethod = $reflection->getName(); if (strpos($this->path, Library::pathSeparator) === 0) { // Absolute Route $route = new Route($controller, $controllerMethod, $this->httpMethods, $this->path); $descriptor->methodUrls[$controllerMethod] = $this->path; } else { // Relative Route $route = new Route($controller, $controllerMethod, $this->httpMethods, $descriptor->routesPrefix . $this->path); $descriptor->methodUrls[$controllerMethod] = $descriptor->routesPrefix . $this->path; } $route->fileDefined = $reflection->getFileName(); $route->lineDefined = $reflection->getStartLine(); $descriptor->routes[] = $route; }
function toRoute() { $route = new Route(Library::getFullyQualifiedClassName($this->c), $this->f, array(), ''); $route->app = $this->a; return $route; }
function printRelationships($relationships) { ?> <a name="relationships"></a> <h3>Relationships</h3> <ul class="relationships"> <?php foreach ($relationships as $relationship) { ?> <li><span class="relationship-type"><?php echo $relationship->getType(); ?> </span> <?php echo $relationship->name; ?> , Class: <a href="<?php echo Library::getFullyQualifiedClassName($relationship->foreignClass); ?> "><?php echo $relationship->foreignClass; ?> </a> <ul class="relationship-details"> <li>ForeignKey: <?php echo $relationship->foreignKey; ?> </li> <li>OnDelete: <?php echo $relationship->onDelete == 'unspecified' ? $relationship->getDefaultOnDeleteMode() : $relationship->onDelete; ?> </li> <?php if ($relationship->through != '') { ?> <li>Through: <?php echo $relationship->through; ?> </li> <?php } ?> </ul> </li> <?php } echo '</ul>'; }
/** * Given a docstring, returns an array of Recess Annotations. * @param $docstring * @return unknown_type */ static function parse($docstring) { preg_match_all('%(?:\\s|\\*)*!(\\S+)[^\\n\\r\\S]*(?:(.*?)(?:\\*/)|(.*))%', $docstring, $result, PREG_PATTERN_ORDER); $annotations = $result[1]; if (isset($result[2][0]) && $result[2][0] != '') { $values = $result[2]; } else { $values = $result[3]; } $returns = array(); if (empty($result[1])) { return array(); } foreach ($annotations as $key => $annotation) { // Strip Whitespace $value = preg_replace('/\\s*(\\(|:|,|\\))[^\\n\\r\\S]*/', '${1}', '(' . $values[$key] . ')'); // Extract Strings preg_match_all('/\'(.*?)(?<!\\\\)\'|"(.*?)(?<!\\\\)"/', $value, $result, PREG_PATTERN_ORDER); $quoted_strings = $result[2]; $value = preg_replace('/\'.*?(?<!\\\\)\'|".*?(?<!\\\\)"/', '%s', $value); // Insert Single Quotes $value = preg_replace('/((?!\\(|,|:))(?!\\))(.*?)((?=\\)|,|:))/', '${1}\'${2}\'${3}', $value); // Array Keyword $value = str_replace('(', 'array(', $value); // Arrows $value = str_replace(':', '=>', $value); $value = vsprintf($value . ';', $quoted_strings); @eval('$array = ' . $value); if (!isset($array)) { throw new InvalidAnnotationValueException('There is an unparseable annotation value: "!' . $annotation . ': ' . $values[$key] . '"', 0, 0, '', 0, array()); } $annotationClass = $annotation . 'Annotation'; $fullyQualified = Library::getFullyQualifiedClassName($annotationClass); if ($annotationClass != $fullyQualified || class_exists($annotationClass, false)) { $annotation = new $annotationClass(); $annotation->init($array); } else { throw new UnknownAnnotationException('Unknown annotation: "' . $annotation . '"', 0, 0, '', 0, get_defined_vars()); } $returns[] = $annotation; } unset($annotations, $values, $result); return $returns; }
Layout::extend('layouts/apps'); $title = 'Uninstall'; ?> <h1>To <span class="removed">Uninstall</span> <?php echo $app->name; ?> ...</h1> <ol> <li><span class="highlight">Open <?php echo $_ENV['dir.bootstrap']; ?> recess-conf.php</span></li> <li>Find the <span class="highlight">RecessConf::$applications</span> array.</li> <?php $appClass = Library::getFullyQualifiedClassName(get_class($app)); ?> <li><span class="highlight">Remove the string '<?php echo $appClass; ?> '</span></li> <li>[Optional] Delete the directory <?php echo $_ENV['dir.apps'] . substr($appClass, 0, strpos($appClass, '.')); ?> </li> </ol> <h2>That's all folks. <a href="<?php echo $controller->urlTo('home'); ?> ">Head back to apps.</a></h2>
<?php Layout::extend('layouts/apps'); $title = $app->name; ?> <h1><?php echo $app->name; ?> </h1> <p>Class: <a href="<?php echo Url::action('RecessToolsCodeController::classInfo', Library::getFullyQualifiedClassName(get_class($app))); ?> "><?php echo get_class($app); ?> </a></p> <div class="span-6"> <h2 class="bottom">Models (<a href="<?php echo $controller->urlTo('createModel', get_class($app)); ?> ">new</a>)</h2> <p>Location: <?php echo Html::anchor(Url::action('RecessToolsCodeController::packageInfo', substr($app->modelsPrefix, 0, -1)), $app->modelsPrefix); ?> </p> <?php function printClassesInNamespace($namespace) { $classes = Library::findClassesIn($namespace); if (!empty($classes)) {