本文整理汇总了PHP中VuFindSearch\ParamBag::getArrayCopy方法的典型用法代码示例。如果您正苦于以下问题:PHP ParamBag::getArrayCopy方法的具体用法?PHP ParamBag::getArrayCopy怎么用?PHP ParamBag::getArrayCopy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VuFindSearch\ParamBag
的用法示例。
在下文中一共展示了ParamBag::getArrayCopy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMergeWithAll
/**
* Test "merge with all"
*
* @return void
*/
public function testMergeWithAll()
{
$bag1 = new ParamBag(['a' => 1]);
$bag2 = new ParamBag(['b' => 2]);
$bag3 = new ParamBag(['c' => 3]);
$bag3->mergeWithAll([$bag1, $bag2]);
$this->assertEquals(['a' => [1], 'b' => [2], 'c' => [3]], $bag3->getArrayCopy());
}
示例2: apply
/**
* Apply query defaults, appends, invariants.
*
* @param ParamBag $params Parameters
* @param array $defaults Query defaults
* @param array $appends Query appends
* @param array $invariants Query invariants
*
* @return void
*/
protected function apply(ParamBag $params, array $defaults, array $appends, array $invariants)
{
$final = $params->getArrayCopy();
$final = array_replace($defaults, $final);
$final = array_merge_recursive($final, $appends);
$final = array_replace($final, $invariants);
$params->exchangeArray($final);
}
示例3: search
/**
* Execute a search.
*
* @param ParamBag $params Parameters
* @param integer $offset Search offset
* @param integer $limit Search limit
*
* @return string
*/
public function search(ParamBag $params, $offset, $limit)
{
$params->set('startRecord', $offset);
$params->set('maximumRecords', $limit);
$params->set('servicelevel', 'full');
$params->set('wskey', $this->wskey);
$response = $this->call('POST', $params->getArrayCopy(), false);
$xml = simplexml_load_string($response);
$docs = isset($xml->records->record) ? $xml->records->record : [];
$finalDocs = [];
foreach ($docs as $doc) {
$finalDocs[] = $doc->recordData->asXML();
}
return ['docs' => $finalDocs, 'offset' => $offset, 'total' => isset($xml->numberOfRecords) ? (int) $xml->numberOfRecords : 0];
}
示例4: search
/**
* Execute a search.
*
* @param ParamBag $params Parameters
* @param int $offset Search offset
* @param int $limit Search limit
*
* @return array
*/
public function search(ParamBag $params, $offset, $limit)
{
$startrec = $offset + 1;
$params->set('startrec', $startrec);
$params->set('numrec', $limit);
$params->set('prof', $this->prof);
$params->set('pwd', $this->pwd);
$response = $this->call('GET', $params->getArrayCopy(), false);
$xml = simplexml_load_string($response);
$finalDocs = [];
foreach ($xml->SearchResults->records->rec as $doc) {
$finalDocs[] = simplexml_load_string($doc->asXML());
}
return ['docs' => $finalDocs, 'offset' => $offset, 'total' => (int) $xml->Hits];
}