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 ( 95a104...d03d4c )
by Guy
27s
created

src/Tasks/DummyQueuedJob.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\Tasks;
4
5
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
6
use Symbiote\QueuedJobs\Services\QueuedJob;
7
8
class DummyQueuedJob extends AbstractQueuedJob implements QueuedJob
9
{
10
    /**
11
     * @param int $number
12
     */
13
    public function __construct($number = 0)
14
    {
15
        if ($number) {
16
            $this->startNumber = $number;
17
            $this->totalSteps = $this->startNumber;
18
        }
19
    }
20
21
    /**
22
     * @return string
23
     */
24
    public function getTitle()
25
    {
26
        return 'Some test job for ' . $this->startNumber . ' seconds';
27
    }
28
29
    /**
30
     * @return string
31
     */
32
    public function getJobType()
33
    {
34
        return QueuedJob::QUEUED;
35
    }
36
37
    public function setup()
38
    {
39
        // just demonstrating how to get a job going...
40
        $this->totalSteps = $this->startNumber;
41
        $this->times = array();
42
    }
43
44 View Code Duplication
    public function process()
45
    {
46
        $times = $this->times;
47
        // needed due to quirks with __set
48
        $times[] = date('Y-m-d H:i:s');
49
        $this->times = $times;
0 ignored issues
show
The property times does not exist on object<Symbiote\QueuedJobs\Tasks\DummyQueuedJob>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
50
51
        $this->addMessage('Updated time to ' . date('Y-m-d H:i:s'));
52
        sleep(1);
53
54
        // make sure we're incrementing
55
        $this->currentStep++;
56
57
        // if ($this->currentStep > 1) {
58
        //     $this->currentStep = 1;
59
        // }
60
61
        // and checking whether we're complete
62
        if ($this->currentStep >= $this->totalSteps) {
63
            $this->isComplete = true;
64
        }
65
    }
66
}
67