Issues (64)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

code/model/UpdateNote.php (41 issues)

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
4
class UpdateNote extends DataObject
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
5
{
6
    private static $fields_to_remove_in_the_cms_fields = [];
0 ignored issues
show
The property $fields_to_remove_in_the_cms_fields is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
7
8
    private static $singular_name = 'Update Note';
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...
9
10
    public function i18n_singular_name()
11
    {
12
        return self::$singular_name;
13
    }
14
15
    private static $plural_name = 'Update Notes';
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...
16
17
    public function i18n_plural_name()
18
    {
19
        return self::$plural_name;
20
    }
21
22
    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...
The property $db is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
23
        'Note' => 'Varchar',
24
        'FutureReminderDate' => 'Date',
25
        'FutureReminderNote' => 'Varchar',
26
        'FutureReminderCompleted' => 'Boolean',
27
        'UpdateNoteRecordID' => 'Int',
28
        'UpdateNoteRecordClass' => 'Varchar(100)'
29
    );
30
31
    private static $has_one = 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...
The property $has_one is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
32
        'UpdatedBy' => 'Member',
33
        'UpdateNoteRecord' => 'DataObject'
34
    );
35
36
    private static $casting = 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...
The property $casting is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
37
        'Title' => 'Varchar'
38
    );
39
40
    private static $indexes = 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...
The property $indexes is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
41
        'UpdateNoteRecordID' => true,
42
        'UpdateNoteRecordClass' => true,
43
        'FutureReminderNote' => true,
44
        'FutureReminderDate' => true
45
    );
46
47
    private static $default_sort = 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...
The property $default_sort is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
48
        'IF("ClassName" = \'UpdateNoteToBeCompleted\' AND "FutureReminderCompleted" = 0, 0, 1)' => 'ASC',
49
        'FutureReminderDate' => 'ASC',
50
        'Created' => 'DESC'
51
    );
52
53
    // private static $required_fields = array();
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
54
55
    private static $summary_fields = 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...
The property $summary_fields is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
56
        'Created.Nice' => 'When',
57
        'LastEdited.Nice' => 'Last Edited',
58
        'UpdateNoteRecord.Title' => 'What',
59
        'Note' => 'Note',
60
        'UpdatedBy.Email' => 'Editor',
61
        'FutureReminderDate.Nice' => 'Future Reminder',
62
        'FutureReminderNote' => 'Reminder Note'
63
    );
64
65
    private static $field_labels = 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...
The property $field_labels is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
66
        'Note' => 'Note',
67
        'FutureReminderDate' => 'Future Reminder Date',
68
        'FutureReminderNote' => 'Future Reminder Note',
69
        'UpdateNoteRecord' => 'What',
70
        'UpdateNoteRecordClass' => 'Record Type',
71
        'UpdateNoteRecordID' => 'Record ID',
72
        'UpdatedBy' => 'Editor'
73
    );
74
75
    /**
76
     *
77
     * PartialMatchFilter
78
     */
79
    private static $searchable_fields = 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...
The property $searchable_fields is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
80
        'UpdatedByID'  => array(
81
            'field' => 'UpdateNoteSearchField',
82
            'filter' => 'ExactMatchFilter',
83
            'title' => 'Edited By'
84
        ),
85
        'Note' => 'PartialMatchFilter',
86
        'FutureReminderDate' => 'PartialMatchFilter',
87
        'FutureReminderNote' => 'PartialMatchFilter',
88
    );
89
90
91
    protected function getEditorsDropdown()
92
    {
93
        $admins = EcommerceRole::list_of_admins(true);
94
        return DropdownField::create(
95
            'UpdatedByID',
96
            'Edited By',
97
            $admins
98
        );
99
    }
100
101
    /**
102
     * e.g.
103
     *    $controller = singleton("MyModelAdmin");
104
     *    return $controller->Link().$this->ClassName."/EditForm/field/".$this->ClassName."/item/".$this->ID."/edit";
105
      */
106
    public function CMSEditLink()
107
    {
108
        return Controller::join_links(
109
            Director::baseURL(),
110
            "/admin/updatenotes/".$this->ClassName."/EditForm/field/".$this->ClassName."/item/".$this->ID."/edit"
111
        );
112
    }
113
114
    /**
115
     * CMS Fields
116
     * @return FieldList
117
     */
118
    public function getCMSFields()
119
    {
120
        $fields = parent::getCMSFields();
121
        $fields->insertBefore(ReadonlyField::create('Created'), 'Note');
0 ignored issues
show
'Note' is of type string, but the function expects a object<FormField>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
122
        $fields->insertBefore(ReadonlyField::create('LastEdited'), 'Note');
0 ignored issues
show
'Note' is of type string, but the function expects a object<FormField>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
123
        $fieldLabels = $this->fieldLabels();
124
        $fields->removeByName('UpdateNoteRecordClass');
125
        $fields->removeByName('UpdateNoteRecordID');
126
127
        $otherFieldsToRemove = $this->Config()->get('fields_to_remove_in_the_cms_fields');
128
        foreach ($otherFieldsToRemove as $field) {
129
            $fields->removeByName($field);
130
            // code...
131
        }
132
        $fields->insertBefore(
133
            ReadonlyField::create(
134
                'Created'
135
            ),
136
            'Note'
0 ignored issues
show
'Note' is of type string, but the function expects a object<FormField>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
137
        );
138
        $fields->insertBefore(
139
            ReadonlyField::create(
140
                'LastEdited'
141
            ),
142
            'Note'
0 ignored issues
show
'Note' is of type string, but the function expects a object<FormField>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
143
        );
144
        if ($whoField = $fields->dataFieldByName('UpdatedByID')) {
0 ignored issues
show
$whoField is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
145
            $fields->removeFieldFromTab('Root.Main', 'UpdatedByID');
146
            $who = $this->UpdatedBy();
0 ignored issues
show
Documentation Bug introduced by
The method UpdatedBy does not exist on object<UpdateNote>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
147
            if ($who && $who->exists()) {
148 View Code Duplication
                if ($who->hasMethod('CMSEditLink')) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
149
                    $fields->addFieldToTab(
150
                        'Root.Main',
151
                        $whoField = ReadonlyField::create(
152
                            'UpdatedByLink',
153
                            $fieldLabels['UpdatedBy'],
154
                            '<h2><a href="'.$who->CMSEditLink().'" target="_blank">'.$who->getTitle().'</a></h2>'
155
                        )
156
                    );
157
                } else {
158
                    $fields->addFieldToTab(
159
                        'Root.Main',
160
                        $whoField = ReadonlyField::create(
161
                            'UpdatedByLink',
162
                            $fieldLabels['UpdatedBy'],
163
                            '<h2>'.$who->getTitle().'.</h2>'
164
                        )
165
                    );
166
                }
167
            } else {
168
                $fields->addFieldToTab(
169
                    'Root.Main',
170
                    $whoField = ReadonlyField::create(
171
                        'UpdatedByLink',
172
                        $fieldLabels['UpdatedBy'],
173
                        '<p class="message warning">no editor found</p>'
174
                    )
175
                );
176
            }
177
            $whoField->dontEscape = true;
178
        }
179
180
        if ($parent = $this->getParent()) {
181 View Code Duplication
            if ($parent->hasMethod('CMSEditLink')) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
182
                $fields->addFieldToTab(
183
                    'Root.Main',
184
                    $parentField = ReadonlyField::create(
185
                        'ParentLink',
186
                        $fieldLabels['UpdateNoteRecord'],
187
                        '<h2><a href="'.$parent->CMSEditLink().'" target="_blank">'.$parent->getTitle().'</a></h2>'
188
                    )
189
                );
190
            } else {
191
                $fields->addFieldToTab(
192
                    'Root.Main',
193
                    $parentField = ReadonlyField::create(
194
                        'ParentLink',
195
                        $fieldLabels['UpdateNoteRecord'],
196
                        '<h2>'.$parent->getTitle().'</h2>'
197
                    )
198
                );
199
            }
200
            $parentField->dontEscape = true;
201
        }
202
        return $fields;
203
    }
204
205
    public function getParentField($fieldLabels = null, $linkMethod = 'CMSEditLink')
206
    {
207
        if ($fieldLabels === null) {
208
            $fieldLabels = $this->fieldLabels();
209
        }
210
        $parentField = null;
0 ignored issues
show
$parentField is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
211
        if ($parent = $this->owner->getParent()) {
0 ignored issues
show
The property owner does not exist on object<UpdateNote>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read 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.");
        }
    }

}

If the property has read access only, you can use the @property-read 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...
212
            if ($parent->hasMethod($linkMethod)) {
213
                $parentField = ReadonlyField::create(
214
                    'ParentLink',
215
                    $fieldLabels['UpdateNoteRecord'],
216
                    '<p><a href="'.$parent->$linkMethod().'" target="_blank">'.$parent->getTitle().'</a></p>'
217
                );
218
            } else {
219
                $parentField = ReadonlyField::create(
220
                    'ParentLink',
221
                    $fieldLabels['UpdateNoteRecord'],
222
                    '<p>'.$parent->getTitle().'</p>'
223
                );
224
            }
225
            $parentField->dontEscape = true;
226
        } else {
227
            $parentField = LiteralField::create('ParentLink', '<p class="message bad">No parent found</p>');
228
        }
229
        return $parentField;
230
    }
231
232
    public function getParent()
0 ignored issues
show
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
233
    {
234
        if ($obj = $this->UpdateNoteRecord()) {
0 ignored issues
show
Documentation Bug introduced by
The method UpdateNoteRecord does not exist on object<UpdateNote>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
235
            return $obj;
236
        } else {
237
            $className = $this->UpdateNoteRecordClass;
0 ignored issues
show
The property UpdateNoteRecordClass does not seem to exist. Did you mean record?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
238
            if ($className && class_exists($className)) {
239
                $id =  intval($this->UpdateNoteRecordID);
0 ignored issues
show
The property UpdateNoteRecordID does not seem to exist. Did you mean record?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
240
                if ($id) {
241
                    return $className::get()->byID($id);
242
                }
243
            }
244
        }
245
    }
246
247
248
    /**
249
     * Event handler called before writing to the database.
250
     */
251
    public function onBeforeWrite()
252
    {
253
        parent::onBeforeWrite();
254
        if ($this->FutureReminderCompleted && $this instanceof UpdateNoteToBeCompleted) {
0 ignored issues
show
The property FutureReminderCompleted does not exist on object<UpdateNote>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read 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.");
        }
    }

}

If the property has read access only, you can use the @property-read 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...
255
            $this->ClassName = 'UpdateNote';
256
        } elseif ($this->FutureReminderDate && ! $this instanceof UpdateNoteToBeCompleted) {
0 ignored issues
show
The property FutureReminderDate does not exist on object<UpdateNote>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read 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.");
        }
    }

}

If the property has read access only, you can use the @property-read 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...
257
            $this->ClassName = 'UpdateNoteToBeCompleted';
258
        } elseif (!$this->FutureReminderDate && $this instanceof UpdateNoteToBeCompleted) {
0 ignored issues
show
The property FutureReminderDate does not exist on object<UpdateNote>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read 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.");
        }
    }

}

If the property has read access only, you can use the @property-read 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...
259
            $this->ClassName = 'UpdateNote';
260
        }
261
    }
262
    /**
263
     * Creating Permissions
264
     * @return bool
265
     */
266
    public function canCreate($member = null)
267
    {
268
        return false;
269
    }
270
271
    /**
272
     * Editing Permissions
273
     * @return bool
0 ignored issues
show
Should the return type not be boolean|string|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
274
     */
275
    public function canEdit($member = null)
276
    {
277
        return parent::canEdit();
278
    }
279
280
    /**
281
     * Deleting Permissions
282
     * @return bool
283
     */
284
    public function canDelete($member = null)
285
    {
286
        return false;
287
    }
288
289
    public function getTitle()
290
    {
291
        $obj = $this->getParent();
292
        if ($obj && $obj->exists()) {
293
            $titleArray = array($this->Created, $obj->getTitle());
294
            if ($this->Note) {
0 ignored issues
show
The property Note does not exist on object<UpdateNote>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read 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.");
        }
    }

}

If the property has read access only, you can use the @property-read 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...
295
                array_push($titleArray, $this->Note);
0 ignored issues
show
The property Note does not exist on object<UpdateNote>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read 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.");
        }
    }

}

If the property has read access only, you can use the @property-read 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...
296
            }
297
            return implode(' - ', $titleArray);
298
        }
299
    }
300
}
301