/** * Test expected interface. * * @return void * * @expectedException Zend\ServiceManager\Exception\RuntimeException * @expectedExceptionMessage Plugin ArrayObject does not belong to VuFind\Search\Base\Params */ public function testExpectedInterface() { $pm = new PluginManager(null); $pm->validatePlugin(new \ArrayObject()); }
/** * Called at the end of the Search Params objects' initFromRequest() method. * This method is responsible for setting search parameters needed by the * recommendation module and for reading any existing search parameters that may * be needed. * * @param \VuFind\Search\Base\Params $params Search parameter object * @param \Zend\StdLib\Parameters $request Parameter object representing user * request. * * @return void */ public function init($params, $request) { if ("retain" !== $this->mode) { $randomParams = $this->paramManager->get($params->getSearchClassId()); } else { $randomParams = clone $params; } foreach ($this->filters as $filter) { $randomParams->addFilter($filter); } $query = $randomParams->getQuery(); $paramBag = $randomParams->getBackendParameters(); $this->results = $this->searchService->random($this->backend, $query, $this->limit, $paramBag)->getRecords(); }
/** * Wrapper to the options plugin manager * * @param string $type The search type of the object to retrieve * * @return \VuFind\Search\Base\Options */ public function __invoke($type = 'Solr') { return $this->manager->get($type); }