Esempio n. 1
0
 function onLoad()
 {
     $this->onCreate();
     if (count(CurrentManifest::getViewIndex()) > 0) {
         $viewIndex = CurrentManifest::getViewIndex();
         $pathIndex = NativeUrl::pathResolver();
         $pathCount = count($pathIndex);
         $leftPath = [];
         $currentView = $viewIndex[self::VIEW_DEFAULT];
         for ($wayNumber = $pathCount; $wayNumber > 0; $wayNumber--) {
             $try = implode("/", $pathIndex);
             if (isset($viewIndex[$try]) && class_exists($viewIndex[$try])) {
                 $currentView = $viewIndex[$try];
                 $leftPath = array_splice(NativeUrl::pathResolver(), $wayNumber);
             } else {
                 array_pop($pathIndex);
             }
         }
         if (class_exists($currentView)) {
             $this->getLogger()->d("{$currentView} view is loaded");
             $class = new $currentView();
             if (!$class instanceof ViewSkeleton) {
                 throw new \InvalidArgumentException("{$currentView} isn't instance of ViewSkeleton");
             }
             EnvironmentVariables::define("currentSkeleton", $currentView);
             $class->onCreate($leftPath);
             $this->onSkeletonLoaded($class);
         } else {
             throw new \InvalidArgumentException("System couldn't find any view handling definition");
         }
     } else {
         throw new \InvalidArgumentException("No view was defined");
     }
     $this->onDestroy();
 }
Esempio n. 2
0
 public function getMethods()
 {
     return NativeUrl::pathResolver();
 }