GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 897149...84a0fb )
by Robbie
01:45 queued 10s
created

QueuedJobsTest/QueuedJobsTest_RecordingLogger.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Symbiote\QueuedJobs\Tests\QueuedJobsTest;
4
5
use Monolog\Logger;
6
use SilverStripe\Dev\TestOnly;
7
8
/**
9
 * Test logger for recording messages
10
 */
11
class QueuedJobsTest_RecordingLogger extends Logger implements TestOnly
12
{
13
    /**
14
     * @var QueuedJobsTest_Handler
15
     */
16
    protected $testHandler = null;
17
18
    public function __construct($name = 'testlogger', array $handlers = array(), array $processors = array())
19
    {
20
        parent::__construct($name, $handlers, $processors);
21
22
        $this->testHandler = new QueuedJobsTest_Handler();
23
        $this->pushHandler($this->testHandler);
24
    }
25
26
    /**
27
     * @return array
28
     */
29
    public function getMessages()
30
    {
31
        return $this->testHandler->getMessages();
32
    }
33
34
    /**
35
     * Clear all messages
36
     */
37
    public function clear()
38
    {
39
        $this->testHandler->clear();
40
    }
41
42
    /**
43
     * Get messages with the given filter
44
     *
45
     * @param string $containing
46
     * @return array Filtered array
47
     */
48
    public function filterMessages($containing)
49
    {
50
        return array_values(array_filter(
51
            $this->getMessages(),
52
            function ($content) use ($containing) {
53
                return stripos($content, $containing) !== false;
54
            }
55
        ));
56
    }
57
58
    /**
59
     * Count all messages containing the given substring
60
     *
61
     * @param string $containing Message to filter by
62
     * @return int
63
     */
64
    public function countMessages($containing = null)
65
    {
66
        if ($containing) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $containing of type string|null is loosely compared to true; this is ambiguous if the string can be empty. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
67
            $messages = $this->filterMessages($containing);
68
        } else {
69
            $messages = $this->getMessages();
70
        }
71
        return count($messages);
72
    }
73
}
74