Passed
Push — master ( b4e3f0...d6a119 )
by Robbie
04:16 queued 02:31
created

src/Solr/Tasks/Solr_BuildTask.php (1 issue)

Labels
Severity
1
<?php
2
namespace SilverStripe\FullTextSearch\Solr\Tasks;
3
4
use Monolog\Handler\StreamHandler;
5
use Psr\Log\LoggerInterface;
6
use SilverStripe\Core\Injector\Injector;
7
use SilverStripe\Dev\BuildTask;
8
use SilverStripe\FullTextSearch\Utils\Logging\SearchLogFactory;
9
10
/**
11
 * Abstract class for build tasks
12
 */
13
class Solr_BuildTask extends BuildTask
14
{
15
    protected $enabled = false;
16
17
    /**
18
     * Logger
19
     *
20
     * @var LoggerInterface
21
     */
22
    protected $logger = null;
23
24
    /**
25
     * Get the monolog logger
26
     *
27
     * @return LoggerInterface
28
     */
29
    public function getLogger()
30
    {
31
        return $this->logger;
32
    }
33
34
    /**
35
     * Assign a new logger
36
     *
37
     * @param LoggerInterface $logger
38
     */
39
    public function setLogger(LoggerInterface $logger)
40
    {
41
        $this->logger = $logger;
42
    }
43
44
    /**
45
     * @return SearchLogFactory
46
     */
47
    protected function getLoggerFactory()
48
    {
49
        return Injector::inst()->get(SearchLogFactory::class);
50
    }
51
52
    /**
53
     * Setup task
54
     *
55
     * @param SS_HTTPReqest $request
0 ignored issues
show
The type SilverStripe\FullTextSea...olr\Tasks\SS_HTTPReqest was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
56
     */
57
    public function run($request)
58
    {
59
        $name = get_class($this);
60
        $verbose = $request->getVar('verbose');
61
62
        // Set new logger
63
        $logger = $this
64
            ->getLoggerFactory()
65
            ->getOutputLogger($name, $verbose);
66
        $this->setLogger($logger);
67
    }
68
}
69