Пример #1
0
 public function &_addOrUpdateClassDetails($class_name, &$File, &$Component, &$SourceAnalyzer, $class_details, $ExtendedClass = null)
 {
     $class_details = array('name' => $class_name, 'file_id' => $File->getId(), 'component_id' => $Component->getId(), 'description' => @$class_details['doc']);
     /*
     'doc' => trim($this->_latest_docs, "\n\t "),
     'doc_metadata' => $this->_latest_attributes,
     'class_name' => $this->_current_class,
     'extends' => trim($this->_current_class_extends),
     */
     $class_details = array_filter($class_details, 'strlen');
     if (!($Class = $this->findFirstBy('name', $class_name))) {
         $SourceAnalyzer->log('Adding class: ' . $class_name);
         if (!empty($ExtendedClass)) {
             $class_details = array('name' => $class_details['name']);
         }
         $Class = new Klass(array('init' => false));
         $Class->setConnection($this->getConnection());
         $Class->setAttributes($class_details);
         $Class->save();
         $SourceAnalyzer->log('Added class: ' . $class_name);
     } elseif (empty($ExtendedClass) && $File->getId() != $Class->get('file_id') || $Component->getId() != $Class->get('component_id')) {
         $SourceAnalyzer->log('Modifying class details: ' . $class_name);
         unset($class_details['name']);
         $Class->setAttributes($class_details);
         $Class->save();
     }
     return $Class;
 }
Пример #2
0
 public function indexFile($file_path)
 {
     $file_path = trim($file_path, '/');
     $FileInstance = new File(array('init' => false));
     if ($this->db) {
         $FileInstance->setConnection($this->db);
     }
     $FileInstance->init();
     if ($UnIndexedPage = $FileInstance->findFirstBy('path AND has_been_analyzed', $file_path, false)) {
         $ComponentInstance = new Component(array('init' => false));
         if ($this->db) {
             $ComponentInstance->setConnection($this->db);
         }
         $ComponentInstance->init();
         $ClassInstance = new Klass(array('init' => false));
         if ($this->db) {
             $ClassInstance->setConnection($this->db);
         }
         $ClassInstance->init();
         $this->log('Analyzing file ' . $UnIndexedPage->path);
         $Component = $ComponentInstance->updateComponentDetails($UnIndexedPage, $this);
         $Classes = $ClassInstance->updateClassDetails($UnIndexedPage, $Component, $this);
         if (!empty($Classes)) {
             //AkDebug::debug($Classes);
         }
         $UnIndexedPage->set('has_been_analyzed', true);
         $UnIndexedPage->save();
     }
 }