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
207fa796
Commit
207fa796
authored
Jan 20, 2018
by
Andreas Möller
Committed by
Markus Kalkbrenner
Jan 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Remove useless else (#553)
parent
bb1659ca
Changes
36
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
72 additions
and
114 deletions
+72
-114
library/Component/DisMax.php
library/Component/DisMax.php
+2
-2
library/Component/Facet/MultiQuery.php
library/Component/Facet/MultiQuery.php
+0
-2
library/Component/FacetSet.php
library/Component/FacetSet.php
+2
-4
library/Component/Highlighting/Highlighting.php
library/Component/Highlighting/Highlighting.php
+0
-2
library/Component/Result/Debug/DocumentSet.php
library/Component/Result/Debug/DocumentSet.php
+1
-3
library/Component/Result/Debug/Timing.php
library/Component/Result/Debug/Timing.php
+0
-2
library/Component/Result/Debug/TimingPhase.php
library/Component/Result/Debug/TimingPhase.php
+0
-2
library/Component/Result/FacetSet.php
library/Component/Result/FacetSet.php
+1
-3
library/Component/Result/Grouping/Result.php
library/Component/Result/Grouping/Result.php
+0
-2
library/Component/Result/Highlighting/Highlighting.php
library/Component/Result/Highlighting/Highlighting.php
+0
-2
library/Component/Result/Highlighting/Result.php
library/Component/Result/Highlighting/Result.php
+2
-2
library/Component/Result/MoreLikeThis/MoreLikeThis.php
library/Component/Result/MoreLikeThis/MoreLikeThis.php
+0
-2
library/Component/Result/Spellcheck/Result.php
library/Component/Result/Spellcheck/Result.php
+5
-7
library/Component/Result/Spellcheck/Suggestion.php
library/Component/Result/Spellcheck/Suggestion.php
+2
-4
library/Component/Result/Stats/Stats.php
library/Component/Result/Stats/Stats.php
+0
-2
library/Component/Result/Suggester/Result.php
library/Component/Result/Suggester/Result.php
+2
-2
library/Component/Result/Terms/Field.php
library/Component/Result/Terms/Field.php
+2
-2
library/Component/Result/Terms/Result.php
library/Component/Result/Terms/Result.php
+2
-2
library/Component/Stats/Stats.php
library/Component/Stats/Stats.php
+2
-4
library/Core/Client/Client.php
library/Core/Client/Client.php
+11
-13
library/Core/Client/Request.php
library/Core/Client/Request.php
+0
-2
library/Core/Configurable.php
library/Core/Configurable.php
+1
-3
library/Core/Query/AbstractRequestBuilder.php
library/Core/Query/AbstractRequestBuilder.php
+4
-4
library/Core/Query/Helper.php
library/Core/Query/Helper.php
+7
-7
library/Plugin/CustomizeRequest/CustomizeRequest.php
library/Plugin/CustomizeRequest/CustomizeRequest.php
+1
-3
library/Plugin/Loadbalancer/Loadbalancer.php
library/Plugin/Loadbalancer/Loadbalancer.php
+7
-7
library/Plugin/Loadbalancer/WeightedRandomChoice.php
library/Plugin/Loadbalancer/WeightedRandomChoice.php
+2
-2
library/QueryType/Analysis/Result/Document.php
library/QueryType/Analysis/Result/Document.php
+1
-3
library/QueryType/Analysis/Result/Item.php
library/QueryType/Analysis/Result/Item.php
+2
-2
library/QueryType/Select/Query/Query.php
library/QueryType/Select/Query/Query.php
+2
-4
library/QueryType/Select/Result/Result.php
library/QueryType/Select/Result/Result.php
+2
-2
library/QueryType/Spellcheck/Result/Result.php
library/QueryType/Spellcheck/Result/Result.php
+2
-2
library/QueryType/Suggester/Result/Dictionary.php
library/QueryType/Suggester/Result/Dictionary.php
+2
-2
library/QueryType/Suggester/Result/Result.php
library/QueryType/Suggester/Result/Result.php
+2
-2
library/QueryType/Terms/Result.php
library/QueryType/Terms/Result.php
+2
-2
library/QueryType/Update/Query/Document/Document.php
library/QueryType/Update/Query/Document/Document.php
+1
-3
No files found.
library/Component/DisMax.php
View file @
207fa796
...
...
@@ -306,10 +306,10 @@ class DisMax extends AbstractComponent
//double add calls for the same BQ are ignored, but non-unique keys cause an exception
if
(
array_key_exists
(
$key
,
$this
->
boostQueries
)
&&
$this
->
boostQueries
[
$key
]
!==
$boostQuery
)
{
throw
new
InvalidArgumentException
(
'A boostquery must have a unique key value within a query'
);
}
else
{
$this
->
boostQueries
[
$key
]
=
$boostQuery
;
}
$this
->
boostQueries
[
$key
]
=
$boostQuery
;
return
$this
;
}
...
...
library/Component/Facet/MultiQuery.php
View file @
207fa796
...
...
@@ -124,8 +124,6 @@ class MultiQuery extends AbstractFacet
{
if
(
isset
(
$this
->
facetQueries
[
$key
]))
{
return
$this
->
facetQueries
[
$key
];
}
else
{
return
;
}
}
...
...
library/Component/FacetSet.php
View file @
207fa796
...
...
@@ -335,10 +335,10 @@ class FacetSet extends AbstractComponent
//double add calls for the same facet are ignored, but non-unique keys cause an exception
if
(
array_key_exists
(
$key
,
$this
->
facets
)
&&
$this
->
facets
[
$key
]
!==
$facet
)
{
throw
new
InvalidArgumentException
(
'A facet must have a unique key value within a query'
);
}
else
{
$this
->
facets
[
$key
]
=
$facet
;
}
$this
->
facets
[
$key
]
=
$facet
;
return
$this
;
}
...
...
@@ -374,8 +374,6 @@ class FacetSet extends AbstractComponent
{
if
(
isset
(
$this
->
facets
[
$key
]))
{
return
$this
->
facets
[
$key
];
}
else
{
return
;
}
}
...
...
library/Component/Highlighting/Highlighting.php
View file @
207fa796
...
...
@@ -98,8 +98,6 @@ class Highlighting extends AbstractComponent
$this
->
addField
(
$name
);
return
$this
->
fields
[
$name
];
}
else
{
return
;
}
}
...
...
library/Component/Result/Debug/DocumentSet.php
View file @
207fa796
...
...
@@ -73,9 +73,7 @@ class DocumentSet implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
docs
[
$key
]))
{
return
$this
->
docs
[
$key
];
}
else
{
return
;
}
}
}
/**
...
...
library/Component/Result/Debug/Timing.php
View file @
207fa796
...
...
@@ -92,8 +92,6 @@ class Timing implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
phases
[
$key
]))
{
return
$this
->
phases
[
$key
];
}
else
{
return
;
}
}
...
...
library/Component/Result/Debug/TimingPhase.php
View file @
207fa796
...
...
@@ -101,8 +101,6 @@ class TimingPhase implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
timings
[
$key
]))
{
return
$this
->
timings
[
$key
];
}
else
{
return
;
}
}
...
...
library/Component/Result/FacetSet.php
View file @
207fa796
...
...
@@ -73,9 +73,7 @@ class FacetSet implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
facets
[
$key
]))
{
return
$this
->
facets
[
$key
];
}
else
{
return
;
}
}
}
/**
...
...
library/Component/Result/Grouping/Result.php
View file @
207fa796
...
...
@@ -85,8 +85,6 @@ class Result implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
groups
[
$key
]))
{
return
$this
->
groups
[
$key
];
}
else
{
return
;
}
}
...
...
library/Component/Result/Highlighting/Highlighting.php
View file @
207fa796
...
...
@@ -73,8 +73,6 @@ class Highlighting implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
results
[
$key
]))
{
return
$this
->
results
[
$key
];
}
else
{
return
;
}
}
...
...
library/Component/Result/Highlighting/Result.php
View file @
207fa796
...
...
@@ -83,9 +83,9 @@ class Result implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
fields
[
$key
]))
{
return
$this
->
fields
[
$key
];
}
else
{
return
array
();
}
return
array
();
}
/**
...
...
library/Component/Result/MoreLikeThis/MoreLikeThis.php
View file @
207fa796
...
...
@@ -73,8 +73,6 @@ class MoreLikeThis implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
results
[
$key
]))
{
return
$this
->
results
[
$key
];
}
else
{
return
;
}
}
...
...
library/Component/Result/Spellcheck/Result.php
View file @
207fa796
...
...
@@ -92,13 +92,13 @@ class Result implements \IteratorAggregate, \Countable
$nrOfCollations
=
count
(
$this
->
collations
);
if
(
$nrOfCollations
==
0
)
{
return
;
}
else
{
if
(
$key
===
null
)
{
return
reset
(
$this
->
collations
);
}
}
return
$this
->
collations
[
$key
];
if
(
$key
===
null
)
{
return
reset
(
$this
->
collations
);
}
return
$this
->
collations
[
$key
];
}
/**
...
...
@@ -134,8 +134,6 @@ class Result implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
suggestions
[
$key
]))
{
return
$this
->
suggestions
[
$key
];
}
else
{
return
;
}
}
...
...
library/Component/Result/Spellcheck/Suggestion.php
View file @
207fa796
...
...
@@ -115,9 +115,9 @@ class Suggestion
$word
=
reset
(
$this
->
words
);
if
(
isset
(
$word
[
'word'
]))
{
return
$word
[
'word'
];
}
else
{
return
$word
;
}
return
$word
;
}
/**
...
...
@@ -142,8 +142,6 @@ class Suggestion
$word
=
reset
(
$this
->
words
);
if
(
isset
(
$word
[
'freq'
]))
{
return
$word
[
'freq'
];
}
else
{
return
;
}
}
}
library/Component/Result/Stats/Stats.php
View file @
207fa796
...
...
@@ -73,8 +73,6 @@ class Stats implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
results
[
$key
]))
{
return
$this
->
results
[
$key
];
}
else
{
return
;
}
}
...
...
library/Component/Result/Suggester/Result.php
View file @
207fa796
...
...
@@ -66,9 +66,9 @@ class Result implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
results
[
$dictionary
]))
{
return
$this
->
results
[
$dictionary
];
}
else
{
return
null
;
}
return
null
;
}
/**
...
...
library/Component/Result/Terms/Field.php
View file @
207fa796
...
...
@@ -45,9 +45,9 @@ class Field implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
terms
[
$field
]))
{
return
$this
->
terms
[
$field
];
}
else
{
return
null
;
}
return
null
;
}
/**
...
...
library/Component/Result/Terms/Result.php
View file @
207fa796
...
...
@@ -65,9 +65,9 @@ class Result implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
results
[
$field
]))
{
return
$this
->
results
[
$field
];
}
else
{
return
null
;
}
return
null
;
}
/**
...
...
library/Component/Stats/Stats.php
View file @
207fa796
...
...
@@ -116,10 +116,10 @@ class Stats extends AbstractComponent
//double add calls for the same field are ignored, but non-unique keys cause an exception
if
(
array_key_exists
(
$key
,
$this
->
fields
)
&&
$this
->
fields
[
$key
]
!==
$field
)
{
throw
new
InvalidArgumentException
(
'A field must have a unique key value'
);
}
else
{
$this
->
fields
[
$key
]
=
$field
;
}
$this
->
fields
[
$key
]
=
$field
;
return
$this
;
}
...
...
@@ -155,8 +155,6 @@ class Stats extends AbstractComponent
{
if
(
isset
(
$this
->
fields
[
$key
]))
{
return
$this
->
fields
[
$key
];
}
else
{
return
;
}
}
...
...
library/Core/Client/Client.php
View file @
207fa796
...
...
@@ -301,13 +301,13 @@ class Client extends Configurable implements ClientInterface
//double add calls for the same endpoint are ignored, but non-unique keys cause an exception
if
(
array_key_exists
(
$key
,
$this
->
endpoints
)
&&
$this
->
endpoints
[
$key
]
!==
$endpoint
)
{
throw
new
InvalidArgumentException
(
'An endpoint must have a unique key'
);
}
else
{
$this
->
endpoints
[
$key
]
=
$endpoint
;
}
// if no default endpoint is set do so now
if
(
null
===
$this
->
defaultEndpoint
)
{
$this
->
defaultEndpoint
=
$key
;
}
$this
->
endpoints
[
$key
]
=
$endpoint
;
// if no default endpoint is set do so now
if
(
null
===
$this
->
defaultEndpoint
)
{
$this
->
defaultEndpoint
=
$key
;
}
return
$this
;
...
...
@@ -474,9 +474,9 @@ class Client extends Configurable implements ClientInterface
$this
->
adapter
=
$adapter
;
return
$this
;
}
else
{
throw
new
InvalidArgumentException
(
'Invalid adapter input for setAdapter'
);
}
throw
new
InvalidArgumentException
(
'Invalid adapter input for setAdapter'
);
}
/**
...
...
@@ -659,11 +659,9 @@ class Client extends Configurable implements ClientInterface
$this
->
registerPlugin
(
$key
,
$this
->
pluginTypes
[
$key
]);
return
$this
->
pluginInstances
[
$key
];
}
else
{
throw
new
OutOfBoundsException
(
'Cannot autoload plugin of unknown type: '
.
$key
);
}
}
else
{
return
;
}
throw
new
OutOfBoundsException
(
'Cannot autoload plugin of unknown type: '
.
$key
);
}
}
...
...
library/Core/Client/Request.php
View file @
207fa796
...
...
@@ -155,8 +155,6 @@ class Request extends Configurable
{
if
(
isset
(
$this
->
params
[
$key
]))
{
return
$this
->
params
[
$key
];
}
else
{
return
;
}
}
...
...
library/Core/Configurable.php
View file @
207fa796
...
...
@@ -132,9 +132,7 @@ class Configurable implements ConfigurableInterface
{
if
(
isset
(
$this
->
options
[
$name
]))
{
return
$this
->
options
[
$name
];
}
else
{
return
;
}
}
}
/**
...
...
library/Core/Query/AbstractRequestBuilder.php
View file @
207fa796
...
...
@@ -121,9 +121,9 @@ abstract class AbstractRequestBuilder implements RequestBuilderInterface
$value
=
(
true
===
(
bool
)
$value
)
?
'true'
:
'false'
;
return
$this
->
attrib
(
$name
,
$value
);
}
else
{
return
''
;
}
return
''
;
}
/**
...
...
@@ -140,8 +140,8 @@ abstract class AbstractRequestBuilder implements RequestBuilderInterface
{
if
(
null
!==
$value
)
{
return
' '
.
$name
.
'="'
.
$value
.
'"'
;
}
else
{
return
''
;
}
return
''
;
}
}
library/Core/Query/Helper.php
View file @
207fa796
...
...
@@ -186,10 +186,10 @@ class Helper
$iso8601
.=
'Z'
;
return
$iso8601
;
}
else
{
// unsupported input
return
false
;
}
// unsupported input
return
false
;
}
/**
...
...
@@ -223,9 +223,9 @@ class Helper
if
(
$inclusive
)
{
return
$field
.
':['
.
$from
.
' TO '
.
$to
.
']'
;
}
else
{
return
$field
.
':{'
.
$from
.
' TO '
.
$to
.
'}'
;
}
return
$field
.
':{'
.
$from
.
' TO '
.
$to
.
'}'
;
}
/**
...
...
@@ -369,9 +369,9 @@ class Helper
}
return
$name
.
'()'
;
}
else
{
return
$name
.
'('
.
implode
(
$params
,
','
)
.
')'
;
}
return
$name
.
'('
.
implode
(
$params
,
','
)
.
')'
;
}
/**
...
...
library/Plugin/CustomizeRequest/CustomizeRequest.php
View file @
207fa796
...
...
@@ -161,9 +161,7 @@ class CustomizeRequest extends AbstractPlugin
{
if
(
isset
(
$this
->
customizations
[
$key
]))
{
return
$this
->
customizations
[
$key
];
}
else
{
return
;
}
}
}
/**
...
...
library/Plugin/Loadbalancer/Loadbalancer.php
View file @
207fa796
...
...
@@ -205,10 +205,10 @@ class Loadbalancer extends AbstractPlugin
if
(
array_key_exists
(
$endpoint
,
$this
->
endpoints
))
{
throw
new
InvalidArgumentException
(
'An endpoint for the loadbalancer plugin must have a unique key'
);
}
else
{
$this
->
endpoints
[
$endpoint
]
=
$weight
;
}
$this
->
endpoints
[
$endpoint
]
=
$weight
;
// reset the randomizer as soon as a new endpoint is added
$this
->
randomizer
=
null
;
...
...
@@ -487,12 +487,12 @@ class Loadbalancer extends AbstractPlugin
// if we get here no more retries available, throw exception
throw
new
RuntimeException
(
'Maximum number of loadbalancer retries reached'
);
}
else
{
// no failover retries, just execute and let an exception bubble upwards
$endpoint
=
$this
->
getRandomEndpoint
();
return
$adapter
->
execute
(
$request
,
$endpoint
);
}
// no failover retries, just execute and let an exception bubble upwards
$endpoint
=
$this
->
getRandomEndpoint
();
return
$adapter
->
execute
(
$request
,
$endpoint
);
}
/**
...
...
library/Plugin/Loadbalancer/WeightedRandomChoice.php
View file @
207fa796
...
...
@@ -145,8 +145,8 @@ class WeightedRandomChoice
if
(
$this
->
lookup
[
$low
]
>=
$random
)
{
return
$low
;
}
else
{
return
$low
+
1
;
}
return
$low
+
1
;
}
}
library/QueryType/Analysis/Result/Document.php
View file @
207fa796
...
...
@@ -149,8 +149,6 @@ class Document extends BaseResult implements \IteratorAggregate, \Countable
if
(
isset
(
$this
->
items
[
$key
]))
{
return
$this
->
items
[
$key
];
}
else
{
return
;
}
}
}
}
library/QueryType/Analysis/Result/Item.php
View file @
207fa796
...
...
@@ -185,9 +185,9 @@ class Item
{
if
(
is_array
(
$this
->
positionHistory
))
{
return
$this
->
positionHistory
;
}
else
{
return
array
();
}
return
array
();
}
/**
...
...
library/QueryType/Select/Query/Query.php
View file @
207fa796
...
...
@@ -607,10 +607,10 @@ class Query extends AbstractQuery implements ComponentAwareQueryInterface
//double add calls for the same FQ are ignored, but non-unique keys cause an exception
if
(
array_key_exists
(
$key
,
$this
->
filterQueries
)
&&
$this
->
filterQueries
[
$key
]
!==
$filterQuery
)
{
throw
new
InvalidArgumentException
(
'A filterquery must have a unique key value within a query'
);
}
else
{
$this
->
filterQueries
[
$key
]
=
$filterQuery
;
}
$this
->
filterQueries
[
$key
]
=
$filterQuery
;
return
$this
;
}
...
...
@@ -646,8 +646,6 @@ class Query extends AbstractQuery implements ComponentAwareQueryInterface
{
if
(
isset
(
$this
->
filterQueries
[
$key
]))
{
return
$this
->
filterQueries
[
$key
];
}
else
{
return
;
}
}
...
...
library/QueryType/Select/Result/Result.php
View file @
207fa796
...
...
@@ -262,9 +262,9 @@ class Result extends BaseResult implements \IteratorAggregate, \Countable
if
(
isset
(
$this
->
components
[
$key
]))
{
return
$this
->
components
[
$key
];
}
else
{
return
null
;
}
return
null
;
}
/**
...
...
library/QueryType/Spellcheck/Result/Result.php
View file @
207fa796
...
...
@@ -153,9 +153,9 @@ class Result extends BaseResult implements \IteratorAggregate, \Countable
if
(
isset
(
$this
->
results
[
$term
]))
{
return
$this
->
results
[
$term
];
}
else
{
return
array
();
}
return
array
();
}
/**
...
...
library/QueryType/Suggester/Result/Dictionary.php
View file @
207fa796
...
...
@@ -83,9 +83,9 @@ class Dictionary implements \IteratorAggregate, \Countable
{
if
(
isset
(
$this
->
terms
[
$term
]))
{
return
$this
->
terms
[
$term
];
}
else
{
return
null
;
}
return
null
;
}
/**
...
...
library/QueryType/Suggester/Result/Result.php
View file @
207fa796
...
...
@@ -144,9 +144,9 @@ class Result extends BaseResult implements \IteratorAggregate, \Countable
if
(
isset
(
$this
->
results
[
$dictionary
]))
{
return
$this
->
results
[
$dictionary
];
}
else
{
return
null
;
}
return
null
;
}
/**
...
...
library/QueryType/Terms/Result.php
View file @
207fa796
...
...
@@ -125,9 +125,9 @@ class Result extends BaseResult implements \IteratorAggregate, \Countable
if
(
isset
(
$this
->
results
[
$field
]))
{
return
$this
->
results
[
$field
];
}
else
{
return
array
();
}
return
array
();
}
/**
...
...
library/QueryType/Update/Query/Document/Document.php
View file @
207fa796
...
...
@@ -273,9 +273,7 @@ class Document extends AbstractDocument implements DocumentInterface
{
if
(
isset
(
$this
->
fieldBoosts
[
$key
]))
{
return
$this
->
fieldBoosts
[
$key
];
}
else
{
return
;
}
}
}
/**
...
...
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