Library::import PHP Method

import() static public method

static public import ( $fullName, $forceLoad = false )
    static function import($fullName, $forceLoad = false)
    {
        if (!isset(self::$classesByFull[$fullName])) {
            self::addClass($fullName);
        }
        $className = self::$classesByFull[$fullName];
        if (!isset(self::$loaded[$className])) {
            self::$loaded[$className] = false;
        }
        if ($forceLoad) {
            self::load($className);
        }
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * The recursive method powering addRouteFor(Request).
  * 
  * @param array Part of a path in reverse order.
  * @param int Current index of path part array - decrements with each step.
  * @param Route The route being added
  * 
  * @return FindRouteResult
  */
 private function addRouteRecursively(&$pathParts, $index, $route)
 {
     // Base Case
     if ($index < 0) {
         foreach ($route->methods as $method) {
             if (isset($this->m[$method])) {
                 Library::import('recess.framework.routing.DuplicateRouteException');
                 throw new DuplicateRouteException($method . ' ' . str_replace('//', '/', $route->path), $route->fileDefined, $route->lineDefined);
             }
             $this->m[$method] = new Rt($route);
         }
         return;
     }
     $nextPart = $pathParts[$index];
     if ($nextPart[0] != '$') {
         $childrenArray =& $this->s;
         $nextKey = $nextPart;
         $isParam = false;
     } else {
         $childrenArray =& $this->p;
         $nextKey = substr($nextPart, 1);
         $isParam = true;
     }
     if (!isset($childrenArray[$nextKey])) {
         $child = new RtNode();
         if ($isParam) {
             $child->c = $nextKey;
         }
         $childrenArray[$nextKey] = $child;
     } else {
         $child = $childrenArray[$nextKey];
     }
     $child->addRouteRecursively($pathParts, $index - 1, $route);
 }
All Usage Examples Of Library::import