Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
solarium
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
solarium
Commits
66f6c1fc
Commit
66f6c1fc
authored
Sep 12, 2013
by
Dorian Villet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typehints in Analysis Document class.
parent
f282c92f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
16 deletions
+19
-16
library/Solarium/QueryType/Analysis/Query/Document.php
library/Solarium/QueryType/Analysis/Query/Document.php
+19
-16
No files found.
library/Solarium/QueryType/Analysis/Query/Document.php
View file @
66f6c1fc
...
...
@@ -41,7 +41,7 @@ use Solarium\Core\Client\Client;
use
Solarium\Exception\RuntimeException
;
use
Solarium\QueryType\Analysis\ResponseParser\Document
as
ResponseParser
;
use
Solarium\QueryType\Analysis\RequestBuilder\Document
as
RequestBuilder
;
use
Solarium\QueryType\Select\Result\DocumentInterface
;
use
Solarium\QueryType\Select\Result\DocumentInterface
as
SelectDocumentInterface
;
use
Solarium\QueryType\Update\Query\Document\DocumentInterface
as
UpdateDocumentInterface
;
/**
...
...
@@ -49,11 +49,14 @@ use Solarium\QueryType\Update\Query\Document\DocumentInterface as UpdateDocument
*/
class
Document
extends
Query
{
const
DOCUMENT_TYPE_HINT_EXCEPTION_MESSAGE
=
'The document argument must either implement
\Solarium\QueryType\Select\Result\DocumentInterface or
\Solarium\QueryType\Update\Query\Document\DocumentInterface.'
;
/**
* Documents to analyze
*
* @var
self[]|
DocumentInterface[]
* @var
SelectDocumentInterface[]|Update
DocumentInterface[]
*/
protected
$documents
=
array
();
...
...
@@ -102,11 +105,16 @@ class Document extends Query
* Add a single document
*
*
* @param self|DocumentInterface $document
* @return self Provides fluent interface
* @param SelectDocumentInterface|UpdateDocumentInterface $document
* @return self Provides fluent interface
* @throws RuntimeException
*/
public
function
addDocument
(
$document
)
{
if
(
!
(
$document
instanceof
SelectDocumentInterface
)
&&
!
(
$document
instanceof
UpdateDocumentInterface
))
{
throw
new
RuntimeException
(
static
::
DOCUMENT_TYPE_HINT_EXCEPTION_MESSAGE
);
}
$this
->
documents
[]
=
$document
;
return
$this
;
...
...
@@ -115,21 +123,16 @@ class Document extends Query
/**
* Add multiple documents
*
* @param self|DocumentInterface[] $documents
* @return self Provides fluent interface
* @throws RuntimeException If any of the given documents does not implement DocumentInterface
* @param SelectDocumentInterface[]|UpdateDocumentInterface[] $documents
* @return self Provides fluent interface
* @throws RuntimeException If any of the given documents does not implement
* any DocumentInterface
*/
public
function
addDocuments
(
$documents
)
{
foreach
(
$documents
as
$document
)
{
if
(
!
(
$document
instanceof
$this
)
&&
!
(
$document
instanceof
DocumentInterface
)
&&
!
(
$document
instanceof
UpdateDocumentInterface
)
)
{
throw
new
RuntimeException
(
'Documents must either implement one of the DocumentInterface or be an instance of '
.
get_called_class
()
);
if
(
!
(
$document
instanceof
SelectDocumentInterface
)
&&
!
(
$document
instanceof
UpdateDocumentInterface
))
{
throw
new
RuntimeException
(
static
::
DOCUMENT_TYPE_HINT_EXCEPTION_MESSAGE
);
}
}
...
...
@@ -141,7 +144,7 @@ class Document extends Query
/**
* Get all documents
*
* @return
self[]|
DocumentInterface[]
* @return
SelectDocumentInterface[]|Update
DocumentInterface[]
*/
public
function
getDocuments
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment