示例#1
0
 private function initialize_replysets($replysets, AfsQuery $query, AfsHelperConfiguration $config)
 {
     foreach ($replysets as $replyset) {
         if (property_exists($replyset, 'meta') && property_exists($replyset->meta, 'producer')) {
             $producer = $replyset->meta->producer;
             if ($producer == AfsProducer::SEARCH) {
                 if ('Promote' == $replyset->meta->uri) {
                     $this->promote = new AfsPromoteReplysetHelper($replyset, $this->config);
                 } else {
                     $replyset_helper = new AfsReplysetHelper($replyset, $query, $config);
                     $feed = $replyset_helper->get_meta()->get_feed();
                     if ($config->is_array_format()) {
                         $this->replysets[$feed] = $replyset_helper->format();
                     } else {
                         $this->replysets[$feed] = $replyset_helper;
                     }
                 }
             } elseif ($producer == AfsProducer::SPELLCHECK) {
                 $this->spellcheck_mgr->add_spellcheck($replyset);
             } elseif ($producer == AfsProducer::CONCEPT) {
                 $this->concepts->add_concept($replyset);
             }
         }
     }
     if ($config->is_array_format()) {
         if (!is_null($this->promote)) {
             $this->promote = $this->promote->format();
         }
     }
 }
 public function testSetAndRetrieveFormat()
 {
     $config = new AfsHelperConfiguration();
     $config->set_helper_format(AfsHelperFormat::ARRAYS);
     $this->assertEquals(AfsHelperFormat::ARRAYS, $config->get_helper_format());
     $this->assertTrue($config->is_array_format());
     $this->assertFalse($config->is_helper_format());
 }