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
f7384596
Commit
f7384596
authored
Sep 12, 2013
by
Bas de Nooijer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #202 from gnutix/typehint-alias-consistency
Typehint alias consistency
parents
85a68aba
2e22d474
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
15 deletions
+14
-15
library/Solarium/QueryType/Analysis/Query/Document.php
library/Solarium/QueryType/Analysis/Query/Document.php
+14
-15
No files found.
library/Solarium/QueryType/Analysis/Query/Document.php
View file @
f7384596
...
@@ -41,8 +41,8 @@ use Solarium\Core\Client\Client;
...
@@ -41,8 +41,8 @@ use Solarium\Core\Client\Client;
use
Solarium\Exception\RuntimeException
;
use
Solarium\Exception\RuntimeException
;
use
Solarium\QueryType\Analysis\ResponseParser\Document
as
ResponseParser
;
use
Solarium\QueryType\Analysis\ResponseParser\Document
as
ResponseParser
;
use
Solarium\QueryType\Analysis\RequestBuilder\Document
as
RequestBuilder
;
use
Solarium\QueryType\Analysis\RequestBuilder\Document
as
RequestBuilder
;
use
Solarium\QueryType\Select\Result\DocumentInterface
as
Select
DocumentInterface
;
use
Solarium\QueryType\Select\Result\DocumentInterface
as
ReadOnly
DocumentInterface
;
use
Solarium\QueryType\Update\Query\Document\DocumentInterface
as
Update
DocumentInterface
;
use
Solarium\QueryType\Update\Query\Document\DocumentInterface
as
DocumentInterface
;
/**
/**
* Analysis document query
* Analysis document query
...
@@ -50,13 +50,13 @@ use Solarium\QueryType\Update\Query\Document\DocumentInterface as UpdateDocument
...
@@ -50,13 +50,13 @@ use Solarium\QueryType\Update\Query\Document\DocumentInterface as UpdateDocument
class
Document
extends
Query
class
Document
extends
Query
{
{
const
DOCUMENT_TYPE_HINT_EXCEPTION_MESSAGE
=
'The document argument must either implement
const
DOCUMENT_TYPE_HINT_EXCEPTION_MESSAGE
=
'The document argument must either implement
\Solarium\QueryType\Select\Result\DocumentInterface or
\Solarium\QueryType\Select\Result\DocumentInterface
(read-only)
or
\Solarium\QueryType\Update\Query\Document\DocumentInterface, instance of %s given.'
;
\Solarium\QueryType\Update\Query\Document\DocumentInterface
(read-write)
, instance of %s given.'
;
/**
/**
* Documents to analyze
* Documents to analyze
*
*
* @var
SelectDocumentInterface[]|Update
DocumentInterface[]
* @var
ReadOnlyDocumentInterface[]|
DocumentInterface[]
*/
*/
protected
$documents
=
array
();
protected
$documents
=
array
();
...
@@ -104,13 +104,13 @@ class Document extends Query
...
@@ -104,13 +104,13 @@ class Document extends Query
/**
/**
* Add a single document
* Add a single document
*
*
* @param
SelectDocumentInterface|Update
DocumentInterface $document
* @param
ReadOnlyDocumentInterface|
DocumentInterface $document
* @return self
Provides fluent interface
* @return self Provides fluent interface
* @throws RuntimeException
If the given document doesn't have the right interface
* @throws RuntimeException If the given document doesn't have the right interface
*/
*/
public
function
addDocument
(
$document
)
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
)));
throw
new
RuntimeException
(
sprintf
(
static
::
DOCUMENT_TYPE_HINT_EXCEPTION_MESSAGE
,
get_class
(
$document
)));
}
}
...
@@ -122,15 +122,14 @@ class Document extends Query
...
@@ -122,15 +122,14 @@ class Document extends Query
/**
/**
* Add multiple documents
* Add multiple documents
*
*
* @param SelectDocumentInterface[]|UpdateDocumentInterface[] $documents
* @param ReadOnlyDocumentInterface[]|DocumentInterface[] $documents
* @return self Provides fluent interface
* @return self Provides fluent interface
* @throws RuntimeException If any of the given documents does not implement
* @throws RuntimeException If the given documents doesn't have the right interface
* any DocumentInterface
*/
*/
public
function
addDocuments
(
$documents
)
public
function
addDocuments
(
$documents
)
{
{
foreach
(
$documents
as
$document
)
{
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
)));
throw
new
RuntimeException
(
sprintf
(
static
::
DOCUMENT_TYPE_HINT_EXCEPTION_MESSAGE
,
get_class
(
$document
)));
}
}
}
}
...
@@ -143,7 +142,7 @@ class Document extends Query
...
@@ -143,7 +142,7 @@ class Document extends Query
/**
/**
* Get all documents
* Get all documents
*
*
* @return
SelectDocumentInterface[]|Update
DocumentInterface[]
* @return
ReadOnlyDocumentInterface[]|
DocumentInterface[]
*/
*/
public
function
getDocuments
()
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