You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
588 B

<?php namespace TomLingham\Searchy\Matchers;
/**
* Matches the start of each word against each word in a search
*
* For example, a search for 'jo ta' would match; 'John Taylor' or 'Joshua B. Takashi'
*
* Class StartOfWordsMatcher
* @package TomLingham\Searchy\Matchers
*/
class StartOfWordsMatcher extends BaseMatcher
{
/**
* @var string
*/
protected $operator = 'LIKE';
/**
* @param $searchString
* @return string
*/
public function formatSearchString( $searchString )
{
return implode('% ', explode(' ', $searchString)) . '%';
}
}