diff --git a/src/Search/FullTextSearch.php b/src/Search/FullTextSearch.php index 142f43a..9f67393 100644 --- a/src/Search/FullTextSearch.php +++ b/src/Search/FullTextSearch.php @@ -30,7 +30,8 @@ class FullTextSearch * abstract indexes). Can optionally be filtered to only return indexes that are subclasses of some class * * @static - * @param String $class - Class name to filter indexes by, so that all returned indexes are subclasses of provided class + * @param String $class - Class name to filter indexes by, so that all returned indexes are subclasses of provided + * class * @param bool $rebuild - If true, don't use cached values */ public static function get_indexes($class = null, $rebuild = false) @@ -99,7 +100,8 @@ class FullTextSearch /** * Sometimes, like when in tests, you want to restrain the actual indexes to a subset * - * Call with one argument - an array of class names, index instances or classname => indexinstance pairs (can be mixed). + * Call with one argument - an array of class names, index instances or classname => indexinstance pairs (can be + * mixed). * Alternatively call with multiple arguments, each of which is a class name or index instance * * From then on, fulltext search system will only see those indexes passed in this most recent call. diff --git a/src/Search/Processors/SearchUpdateCommitJobProcessor.php b/src/Search/Processors/SearchUpdateCommitJobProcessor.php index 7f85a64..8bc4148 100644 --- a/src/Search/Processors/SearchUpdateCommitJobProcessor.php +++ b/src/Search/Processors/SearchUpdateCommitJobProcessor.php @@ -2,21 +2,20 @@ namespace SilverStripe\FullTextSearch\Search\Processors; +use DateTime; +use DateInterval; use SilverStripe\FullTextSearch\Search\FullTextSearch; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Injector\Injector; use SilverStripe\ORM\FieldType\DBDatetime; -use DateTime; -use DateInterval; use stdClass; - -if (!interface_exists('Symbiote\QueuedJobs\Services\QueuedJob')) { - return; -} - use Symbiote\QueuedJobs\Services\QueuedJob; use Symbiote\QueuedJobs\Services\QueuedJobService; +if (!interface_exists(QueuedJob::class)) { + return; +} + class SearchUpdateCommitJobProcessor implements QueuedJob { /** diff --git a/src/Search/Processors/SearchUpdateQueuedJobProcessor.php b/src/Search/Processors/SearchUpdateQueuedJobProcessor.php index 06596a4..2433d87 100644 --- a/src/Search/Processors/SearchUpdateQueuedJobProcessor.php +++ b/src/Search/Processors/SearchUpdateQueuedJobProcessor.php @@ -4,14 +4,13 @@ namespace SilverStripe\FullTextSearch\Search\Processors; use SilverStripe\Core\Config\Config; use stdClass; - -if (!interface_exists('Symbiote\QueuedJobs\Services\QueuedJob')) { - return; -} - use Symbiote\QueuedJobs\Services\QueuedJob; use Symbiote\QueuedJobs\Services\QueuedJobService; +if (!interface_exists(QueuedJob::class)) { + return; +} + class SearchUpdateQueuedJobProcessor extends SearchUpdateBatchedProcessor implements QueuedJob { /** diff --git a/src/Search/SearchIntrospection.php b/src/Search/SearchIntrospection.php index 8f061d0..f222181 100644 --- a/src/Search/SearchIntrospection.php +++ b/src/Search/SearchIntrospection.php @@ -45,7 +45,7 @@ class SearchIntrospection $classes = array_unique(array_merge($classes, array_values(ClassInfo::subclassesFor($class)))); } - $idx = array_search('SilverStripe\ORM\DataObject', $classes); + $idx = array_search(DataObject::class, $classes); if ($idx !== false) { array_splice($classes, 0, $idx+1); } diff --git a/src/Search/Updaters/SearchUpdater.php b/src/Search/Updaters/SearchUpdater.php index 2098db3..ee7f272 100644 --- a/src/Search/Updaters/SearchUpdater.php +++ b/src/Search/Updaters/SearchUpdater.php @@ -14,12 +14,12 @@ use SilverStripe\FullTextSearch\Search\Processors\SearchUpdateImmediateProcessor use ReflectionClass; /** - * This class is responsible for capturing changes to DataObjects and triggering index updates of the resulting dirty index - * items. + * This class is responsible for capturing changes to DataObjects and triggering index updates of the resulting dirty + * index items. * - * Attached automatically by _config calling SearchUpdater#bind_manipulation_capture. Overloads the current database connector's - * manipulate method - basically we need to capture a manipulation _after_ all the augmentManipulation code (for instance Version's) - * is run + * Attached automatically by _config calling SearchUpdater#bind_manipulation_capture. Overloads the current database + * connector's manipulate method - basically we need to capture a manipulation _after_ all the augmentManipulation code + * (for instance Version's) is run * * Pretty closely tied to the field structure of SearchIndex. * diff --git a/src/Solr/Reindex/Handlers/SolrReindexQueuedHandler.php b/src/Solr/Reindex/Handlers/SolrReindexQueuedHandler.php index 3289580..e1e9fea 100644 --- a/src/Solr/Reindex/Handlers/SolrReindexQueuedHandler.php +++ b/src/Solr/Reindex/Handlers/SolrReindexQueuedHandler.php @@ -11,15 +11,14 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\FullTextSearch\Solr\Reindex\Jobs\SolrReindexQueuedJob; use SilverStripe\FullTextSearch\Solr\Reindex\Jobs\SolrReindexGroupQueuedJob; use SilverStripe\FullTextSearch\Search\Processors\SearchUpdateCommitJobProcessor; - -if (!interface_exists('Symbiote\QueuedJobs\Services\QueuedJob')) { - return; -} - use Symbiote\QueuedJobs\Services\QueuedJob; use Symbiote\QueuedJobs\Services\QueuedJobService; use Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor; +if (!interface_exists(QueuedJob::class)) { + return; +} + /** * Represents a queued task to start the reindex job */ diff --git a/src/Solr/Reindex/Jobs/SolrReindexGroupQueuedJob.php b/src/Solr/Reindex/Jobs/SolrReindexGroupQueuedJob.php index 92c1730..3566441 100644 --- a/src/Solr/Reindex/Jobs/SolrReindexGroupQueuedJob.php +++ b/src/Solr/Reindex/Jobs/SolrReindexGroupQueuedJob.php @@ -2,7 +2,9 @@ namespace SilverStripe\FullTextSearch\Solr\Reindex\Jobs; -if (!interface_exists('Symbiote\QueuedJobs\Services\QueuedJob')) { +use Symbiote\QueuedJobs\Services\QueuedJob; + +if (!interface_exists(QueuedJob::class)) { return; } diff --git a/src/Solr/Reindex/Jobs/SolrReindexQueuedJob.php b/src/Solr/Reindex/Jobs/SolrReindexQueuedJob.php index 11128d3..83da226 100644 --- a/src/Solr/Reindex/Jobs/SolrReindexQueuedJob.php +++ b/src/Solr/Reindex/Jobs/SolrReindexQueuedJob.php @@ -2,7 +2,9 @@ namespace SilverStripe\FullTextSearch\Solr\Reindex\Jobs; -if (!interface_exists('Symbiote\QueuedJobs\Services\QueuedJob')) { +use Symbiote\QueuedJobs\Services\QueuedJob; + +if (!interface_exists(QueuedJob::class)) { return; } diff --git a/src/Solr/Reindex/Jobs/SolrReindexQueuedJobBase.php b/src/Solr/Reindex/Jobs/SolrReindexQueuedJobBase.php index 0e0fc54..074638e 100644 --- a/src/Solr/Reindex/Jobs/SolrReindexQueuedJobBase.php +++ b/src/Solr/Reindex/Jobs/SolrReindexQueuedJobBase.php @@ -8,13 +8,12 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\FullTextSearch\Solr\Reindex\Handlers\SolrReindexHandler; use SilverStripe\FullTextSearch\Utils\Logging\SearchLogFactory; use stdClass; +use Symbiote\QueuedJobs\Services\QueuedJob; -if (!interface_exists('Symbiote\QueuedJobs\Services\QueuedJob')) { +if (!interface_exists(QueuedJob::class)) { return; } -use Symbiote\QueuedJobs\Services\QueuedJob; - /** * Base class for jobs which perform re-index */ diff --git a/src/Solr/SolrIndex.php b/src/Solr/SolrIndex.php index 1748363..980080d 100644 --- a/src/Solr/SolrIndex.php +++ b/src/Solr/SolrIndex.php @@ -822,7 +822,8 @@ abstract class SolrIndex extends SearchIndex // Extract string suggestion $suggestion = $this->getCollatedSuggestion($res->spellcheck->suggestions->collation); - // The collation, including advanced query params (e.g. +), suitable for making another query programmatically. + // The collation, including advanced query params (e.g. +), suitable for making another query + // programmatically. $ret['Suggestion'] = $suggestion; // A human friendly version of the suggestion, suitable for 'Did you mean $SuggestionNice?' display. diff --git a/src/Utils/Logging/MonologFactory.php b/src/Utils/Logging/MonologFactory.php index b8d3eb3..6b6d779 100644 --- a/src/Utils/Logging/MonologFactory.php +++ b/src/Utils/Logging/MonologFactory.php @@ -5,9 +5,11 @@ namespace SilverStripe\FullTextSearch\Utils\Logging; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LineFormatter; use Monolog\Handler\HandlerInterface; +use Monolog\Handler\StreamHandler; use Monolog\Logger; use SilverStripe\Control\Director; use SilverStripe\Core\Injector\Injector; +use SilverStripe\FullTextSearch\Utils\Logging\QueuedJobLogHandler; /** * Provides logging based on monolog @@ -53,7 +55,7 @@ class MonologFactory implements SearchLogFactory // Unless cli, force output to php://output $stream = Director::is_cli() ? $stream : 'php://output'; $handler = Injector::inst()->createWithArgs( - 'Monolog\Handler\StreamHandler', + StreamHandler::class, array($stream, $level, $bubble) ); $handler->setFormatter($formatter); @@ -73,7 +75,7 @@ class MonologFactory implements SearchLogFactory $format = "

$format

"; } return Injector::inst()->createWithArgs( - 'Monolog\Formatter\LineFormatter', + LineFormatter::class, array($format) ); } @@ -87,7 +89,7 @@ class MonologFactory implements SearchLogFactory protected function getLoggerFor($name) { return Injector::inst()->createWithArgs( - 'Monolog\Logger', + Logger::class, array(strtolower($name)) ); } @@ -101,7 +103,7 @@ class MonologFactory implements SearchLogFactory protected function getJobHandler($job) { return Injector::inst()->createWithArgs( - 'SilverStripe\FullTextSearch\Utils\Logging\QueuedJobLogHandler', + QueuedJobLogHandler::class, array($job, Logger::INFO) ); } diff --git a/src/Utils/Logging/QueuedJobLogHandler.php b/src/Utils/Logging/QueuedJobLogHandler.php index 76eb581..ceb807a 100644 --- a/src/Utils/Logging/QueuedJobLogHandler.php +++ b/src/Utils/Logging/QueuedJobLogHandler.php @@ -4,13 +4,12 @@ namespace SilverStripe\FullTextSearch\Utils\Logging; use Monolog\Handler\AbstractProcessingHandler; use Monolog\Logger; +use Symbiote\QueuedJobs\Services\QueuedJob; -if (!interface_exists('Symbiote\QueuedJobs\Services\QueuedJob')) { +if (!interface_exists(QueuedJob::class)) { return; } -use Symbiote\QueuedJobs\Services\QueuedJob; - /** * Handler for logging events into QueuedJob message data */