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.

TestScheduledDataObject   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A onScheduledExecution() 0 5 1
1
<?php
2
3
namespace Symbiote\QueuedJobs\Tests\ScheduledExecutionTest;
4
5
use SilverStripe\ORM\DataObject;
6
use SilverStripe\Dev\TestOnly;
7
use Symbiote\QueuedJobs\Extensions\ScheduledExecutionExtension;
8
9
class TestScheduledDataObject extends DataObject implements TestOnly
10
{
11
    private static $table_name = 'TestScheduledDataObject';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
12
13
    private static $db = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
14
        'Title' => 'Varchar',
15
        'Message' => 'Varchar',
16
    );
17
18
    private static $extensions = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
19
        ScheduledExecutionExtension::class
20
    );
21
22
    public function onScheduledExecution()
23
    {
24
        $this->Message = 'EXECUTED';
0 ignored issues
show
Documentation introduced by
The property Message does not exist on object<Symbiote\QueuedJo...estScheduledDataObject>. 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...
25
        $this->write();
26
    }
27
}
28