Skip to content

Commit

Permalink
Merge branch 'shieldo-remove_document_check' into develop (PR solariu…
Browse files Browse the repository at this point in the history
  • Loading branch information
basdenooijer committed Dec 22, 2014
2 parents a9d8a52 + 3d2e882 commit 36b27d7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions library/Solarium/QueryType/Update/Query/Command/Add.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ public function addDocument(DocumentInterface $document)
*/
public function addDocuments($documents)
{
foreach ($documents as $document) {
if (!($document instanceof DocumentInterface)) {
throw new RuntimeException('Documents must implement DocumentInterface.');
//only check documents for type if in an array (iterating a Traversable may do unnecessary work)
if (is_array($documents)) {
foreach ($documents as $document) {
if (!($document instanceof DocumentInterface)) {
throw new RuntimeException('Documents must implement DocumentInterface.');
}
}
}

Expand Down

0 comments on commit 36b27d7

Please sign in to comment.