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
d684977a
Commit
d684977a
authored
Aug 21, 2013
by
Dorian Villet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return null explicitely in methods and PHPDoc.
parent
045709fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
35 deletions
+39
-35
library/Solarium/QueryType/Select/ResponseParser/Component/FacetSet.php
...um/QueryType/Select/ResponseParser/Component/FacetSet.php
+39
-35
No files found.
library/Solarium/QueryType/Select/ResponseParser/Component/FacetSet.php
View file @
d684977a
...
...
@@ -144,19 +144,20 @@ class FacetSet extends ResponseParserAbstract implements ComponentParserInterfac
* @param Query $query
* @param QueryFacetField $facet
* @param array $data
* @return ResultFacetField
* @return ResultFacetField
|null
*/
protected
function
facetField
(
$query
,
$facet
,
$data
)
{
$key
=
$facet
->
getKey
();
if
(
isset
(
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]))
{
if
(
$query
->
getResponseWriter
()
==
$query
::
WT_JSON
)
{
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]
=
$this
->
convertToKeyValueArray
(
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]);
}
if
(
!
isset
(
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]))
{
return
null
;
}
return
new
ResultFacetField
(
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]);
if
(
$query
->
getResponseWriter
()
==
$query
::
WT_JSON
)
{
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]
=
$this
->
convertToKeyValueArray
(
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]);
}
return
new
ResultFacetField
(
$data
[
'facet_counts'
][
'facet_fields'
][
$key
]);
}
/**
...
...
@@ -164,17 +165,16 @@ class FacetSet extends ResponseParserAbstract implements ComponentParserInterfac
*
* @param QueryFacetQuery $facet
* @param array $data
* @return ResultFacetQuery
* @return ResultFacetQuery
|null
*/
protected
function
facetQuery
(
$facet
,
$data
)
{
$key
=
$facet
->
getKey
();
if
(
isset
(
$data
[
'facet_counts'
][
'facet_queries'
][
$key
]))
{
$value
=
$data
[
'facet_counts'
][
'facet_queries'
][
$key
];
return
new
ResultFacetQuery
(
$value
);
if
(
!
isset
(
$data
[
'facet_counts'
][
'facet_queries'
][
$key
]))
{
return
null
;
}
return
new
ResultFacetQuery
(
$data
[
'facet_counts'
][
'facet_queries'
][
$key
]);
}
/**
...
...
@@ -182,7 +182,7 @@ class FacetSet extends ResponseParserAbstract implements ComponentParserInterfac
*
* @param QueryFacetMultiQuery $facet
* @param array $data
* @return ResultFacetMultiQuery
* @return ResultFacetMultiQuery
|null
*/
protected
function
facetMultiQuery
(
$facet
,
$data
)
{
...
...
@@ -195,9 +195,11 @@ class FacetSet extends ResponseParserAbstract implements ComponentParserInterfac
}
}
if
(
count
(
$values
)
>
0
)
{
return
n
ew
ResultFacetMultiQuery
(
$values
)
;
if
(
count
(
$values
)
<=
0
)
{
return
n
ull
;
}
return
new
ResultFacetMultiQuery
(
$values
);
}
/**
...
...
@@ -206,27 +208,28 @@ class FacetSet extends ResponseParserAbstract implements ComponentParserInterfac
* @param Query $query
* @param QueryFacetRange $facet
* @param array $data
* @return ResultFacetRange
* @return ResultFacetRange
|null
*/
protected
function
facetRange
(
$query
,
$facet
,
$data
)
{
$key
=
$facet
->
getKey
();
if
(
isset
(
$data
[
'facet_counts'
][
'facet_ranges'
][
$key
]))
{
$data
=
$data
[
'facet_counts'
][
'facet_ranges'
][
$key
];
$before
=
(
isset
(
$data
[
'before'
]))
?
$data
[
'before'
]
:
null
;
$after
=
(
isset
(
$data
[
'after'
]))
?
$data
[
'after'
]
:
null
;
$between
=
(
isset
(
$data
[
'between'
]))
?
$data
[
'between'
]
:
null
;
$start
=
(
isset
(
$data
[
'start'
]))
?
$data
[
'start'
]
:
null
;
$end
=
(
isset
(
$data
[
'end'
]))
?
$data
[
'end'
]
:
null
;
$gap
=
(
isset
(
$data
[
'gap'
]))
?
$data
[
'gap'
]
:
null
;
if
(
$query
->
getResponseWriter
()
==
$query
::
WT_JSON
)
{
$data
[
'counts'
]
=
$this
->
convertToKeyValueArray
(
$data
[
'counts'
]);
}
if
(
!
isset
(
$data
[
'facet_counts'
][
'facet_ranges'
][
$key
]))
{
return
null
;
}
return
new
ResultFacetRange
(
$data
[
'counts'
],
$before
,
$after
,
$between
,
$start
,
$end
,
$gap
);
$data
=
$data
[
'facet_counts'
][
'facet_ranges'
][
$key
];
$before
=
(
isset
(
$data
[
'before'
]))
?
$data
[
'before'
]
:
null
;
$after
=
(
isset
(
$data
[
'after'
]))
?
$data
[
'after'
]
:
null
;
$between
=
(
isset
(
$data
[
'between'
]))
?
$data
[
'between'
]
:
null
;
$start
=
(
isset
(
$data
[
'start'
]))
?
$data
[
'start'
]
:
null
;
$end
=
(
isset
(
$data
[
'end'
]))
?
$data
[
'end'
]
:
null
;
$gap
=
(
isset
(
$data
[
'gap'
]))
?
$data
[
'gap'
]
:
null
;
if
(
$query
->
getResponseWriter
()
==
$query
::
WT_JSON
)
{
$data
[
'counts'
]
=
$this
->
convertToKeyValueArray
(
$data
[
'counts'
]);
}
return
new
ResultFacetRange
(
$data
[
'counts'
],
$before
,
$after
,
$between
,
$start
,
$end
,
$gap
);
}
/**
...
...
@@ -235,15 +238,16 @@ class FacetSet extends ResponseParserAbstract implements ComponentParserInterfac
* @param Query $query
* @param QueryFacetPivot $facet
* @param array $data
* @return ResultFacetPivot
* @return ResultFacetPivot
|null
*/
protected
function
facetPivot
(
$query
,
$facet
,
$data
)
{
$key
=
implode
(
','
,
$facet
->
getFields
());
if
(
isset
(
$data
[
'facet_counts'
][
'facet_pivot'
][
$key
]))
{
$data
=
$data
[
'facet_counts'
][
'facet_pivot'
][
$key
];
return
new
ResultFacetPivot
(
$data
);
if
(
!
isset
(
$data
[
'facet_counts'
][
'facet_pivot'
][
$key
]))
{
return
null
;
}
return
new
ResultFacetPivot
(
$data
[
'facet_counts'
][
'facet_pivot'
][
$key
]);
}
}
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