Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 7 |
SuggestScoringMethodFactory | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 7 |
getScoringMethod | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 7 |
<?php | |
namespace CirrusSearch\BuildDocument\Completion; | |
use InvalidArgumentException; | |
/** | |
* Create certain suggestion scoring method, by name. | |
*/ | |
class SuggestScoringMethodFactory { | |
/** | |
* @param string $scoringMethod the name of the scoring method | |
* @return SuggestScoringMethod | |
* @throws InvalidArgumentException | |
*/ | |
public static function getScoringMethod( $scoringMethod ) { | |
switch ( $scoringMethod ) { | |
case 'incomingLinks': | |
return new IncomingLinksScoringMethod(); | |
case 'quality': | |
return new QualityScore(); | |
case 'popqual': | |
return new PQScore(); | |
} | |
throw new InvalidArgumentException( 'Unknown scoring method ' . $scoringMethod ); | |
} | |
} |