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
96c412b5
Commit
96c412b5
authored
Sep 12, 2013
by
Dorian Villet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be more transparent and consistent in typehint aliases.
parent
85a68aba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
library/Solarium/QueryType/Analysis/Query/Document.php
library/Solarium/QueryType/Analysis/Query/Document.php
+10
-10
No files found.
library/Solarium/QueryType/Analysis/Query/Document.php
View file @
96c412b5
...
...
@@ -41,8 +41,8 @@ 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
as
Select
DocumentInterface
;
use
Solarium\QueryType\Update\Query\Document\DocumentInterface
as
Update
DocumentInterface
;
use
Solarium\QueryType\Select\Result\DocumentInterface
as
ReadOnly
DocumentInterface
;
use
Solarium\QueryType\Update\Query\Document\DocumentInterface
as
DocumentInterface
;
/**
* Analysis document query
...
...
@@ -50,13 +50,13 @@ 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, instance of %s given.'
;
\Solarium\QueryType\Select\Result\DocumentInterface
(read-only)
or
\Solarium\QueryType\Update\Query\Document\DocumentInterface
(read-write)
, instance of %s given.'
;
/**
* Documents to analyze
*
* @var
SelectDocumentInterface[]|Update
DocumentInterface[]
* @var
ReadOnlyDocumentInterface[]|
DocumentInterface[]
*/
protected
$documents
=
array
();
...
...
@@ -104,13 +104,13 @@ class Document extends Query
/**
* Add a single document
*
* @param
SelectDocumentInterface|Update
DocumentInterface $document
* @param
ReadOnlyDocumentInterface|
DocumentInterface $document
* @return self Provides fluent interface
* @throws RuntimeException If the given document doesn't have the right interface
*/
public
function
addDocument
(
$document
)
{
if
(
!
(
$document
instanceof
SelectDocumentInterface
)
&&
!
(
$document
instanceof
Update
DocumentInterface
))
{
if
(
!
(
$document
instanceof
ReadOnlyDocumentInterface
)
&&
!
(
$document
instanceof
DocumentInterface
))
{
throw
new
RuntimeException
(
sprintf
(
static
::
DOCUMENT_TYPE_HINT_EXCEPTION_MESSAGE
,
get_class
(
$document
)));
}
...
...
@@ -122,7 +122,7 @@ class Document extends Query
/**
* Add multiple documents
*
* @param
SelectDocumentInterface[]|Update
DocumentInterface[] $documents
* @param
ReadOnlyDocumentInterface[]|
DocumentInterface[] $documents
* @return self Provides fluent interface
* @throws RuntimeException If any of the given documents does not implement
* any DocumentInterface
...
...
@@ -130,7 +130,7 @@ class Document extends Query
public
function
addDocuments
(
$documents
)
{
foreach
(
$documents
as
$document
)
{
if
(
!
(
$document
instanceof
SelectDocumentInterface
)
&&
!
(
$document
instanceof
Update
DocumentInterface
))
{
if
(
!
(
$document
instanceof
ReadOnlyDocumentInterface
)
&&
!
(
$document
instanceof
DocumentInterface
))
{
throw
new
RuntimeException
(
sprintf
(
static
::
DOCUMENT_TYPE_HINT_EXCEPTION_MESSAGE
,
get_class
(
$document
)));
}
}
...
...
@@ -143,7 +143,7 @@ class Document extends Query
/**
* Get all documents
*
* @return
SelectDocumentInterface[]|Update
DocumentInterface[]
* @return
ReadOnlyDocumentInterface[]|
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