Skip to content

Commit

Permalink
Remove call_user_func from record factories (extracted from vufind-or…
Browse files Browse the repository at this point in the history
  • Loading branch information
EreMaijala authored and demiankatz committed Nov 29, 2024
1 parent 0247078 commit 0715d34
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
use VuFindSearch\Exception\InvalidArgumentException;
use VuFindSearch\Response\RecordCollectionFactoryInterface;

use function call_user_func;
use function gettype;
use function is_array;
use function is_callable;
Expand Down Expand Up @@ -104,7 +103,7 @@ public function factory($response)
?? $response['Records'] ?? [];

foreach ($records as $record) {
$collection->add(call_user_func($this->recordFactory, $record), false);
$collection->add(($this->recordFactory)($record), false);
}
return $collection;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
use VuFindSearch\Exception\InvalidArgumentException;
use VuFindSearch\Response\RecordCollectionFactoryInterface;

use function call_user_func;
use function gettype;
use function is_array;
use function is_callable;
Expand Down Expand Up @@ -102,7 +101,7 @@ public function factory($response)
}
$collection = new $this->collectionClass($response);
foreach ($response['docs'] as $doc) {
$collection->add(call_user_func($this->recordFactory, $doc), false);
$collection->add(($this->recordFactory)($doc), false);
}
return $collection;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
use VuFindSearch\Exception\InvalidArgumentException;
use VuFindSearch\Response\RecordCollectionFactoryInterface;

use function call_user_func;
use function is_callable;

/**
Expand Down Expand Up @@ -96,7 +95,7 @@ public function factory($response)
$response['offset']
);
foreach ($response['records'] as $doc) {
$collection->add(call_user_func($this->recordFactory, $doc), false);
$collection->add(($this->recordFactory)($doc), false);
}
return $collection;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
use VuFindSearch\Exception\InvalidArgumentException;
use VuFindSearch\Response\RecordCollectionFactoryInterface;

use function call_user_func;
use function gettype;
use function is_array;
use function sprintf;
Expand Down Expand Up @@ -108,7 +107,7 @@ public function factory($response)
if (isset($doc['id']) && ($hl = $hlDetails[$doc['id']] ?? [])) {
$doc['__highlight_details'] = $hl;
}
$collection->add(call_user_func($this->recordFactory, $doc), false);
$collection->add(($this->recordFactory)($doc), false);
}
return $collection;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
use VuFindSearch\Exception\InvalidArgumentException;
use VuFindSearch\Response\RecordCollectionFactoryInterface;

use function call_user_func;
use function gettype;
use function is_array;
use function is_callable;
Expand Down Expand Up @@ -105,7 +104,7 @@ public function factory($response)
}
$collection = new $this->collectionClass($response);
foreach ($response['docs'] as $doc) {
$collection->add(call_user_func($this->recordFactory, $doc), false);
$collection->add(($this->recordFactory)($doc), false);
}
return $collection;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

use VuFindSearch\Exception\InvalidArgumentException;

use function call_user_func;
use function gettype;
use function is_array;
use function is_callable;
Expand Down Expand Up @@ -104,7 +103,7 @@ public function factory($response)
}
$collection = new $this->collectionClass($response);
foreach ($this->getDocumentListFromResponse($response) as $doc) {
$collection->add(call_user_func($this->recordFactory, $doc), false);
$collection->add(($this->recordFactory)($doc), false);
}
return $collection;
}
Expand Down

0 comments on commit 0715d34

Please sign in to comment.