Issues (538)

programs/Set/AppNotificationSet.php (5 issues)

1
<?php
2
3
// -------------------------------------------------------------------------
4
// OVIDENTIA http://www.ovidentia.org
5
// Ovidentia is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 2, or (at your option)
8
// any later version.
9
//
10
// This program is distributed in the hope that it will be useful, but
11
// WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
// See the GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18
// USA.
19
// -------------------------------------------------------------------------
20
/**
21
 * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
22
 * @copyright Copyright (c) 2022 by SI4YOU ({@link https://www.siforyou.com})
23
 */
24
namespace Capwelton\LibApp\Set;
25
26
use Capwelton\LibApp\Func_App;
27
use function Capwelton\LibOrm\ORM_UserField;
0 ignored issues
show
The function Capwelton\LibOrm\ORM_UserField was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
28
use function Capwelton\LibOrm\ORM_StringField;
0 ignored issues
show
The function Capwelton\LibOrm\ORM_StringField was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
29
use function Capwelton\LibOrm\ORM_BoolField;
0 ignored issues
show
The function Capwelton\LibOrm\ORM_BoolField was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
30
31
/**
32
 * @property ORM_UserField $user
33
 * @property ORM_StringField $title
34
 * @property ORM_StringField $description
35
 * @property ORM_StringField $action
36
 * @property ORM_StringField $imagePath
37
 * @property ORM_BoolField $seen
38
 *
39
 * @method app_Notification get()
40
 * @method app_Notification request()
41
 * @method app_Notification[]|\ORM_Iterator select()
42
 * @method app_Notification newRecord()
43
 * @method Func_App App()
44
 */
45
class AppNotificationSet extends AppTraceableRecordSet
46
{
47
    
48
    /**
49
     * @param Func_App $App
50
     */
51
    public function __construct(Func_App $App)
52
    {
53
        parent::__construct($App);
54
        
55
        $App = $this->App();
0 ignored issues
show
The assignment to $App is dead and can be removed.
Loading history...
56
        
57
        $this->setPrimaryKey('id');
58
        
59
        $this->addFields(
60
            ORM_UserField('user'), 
61
            ORM_StringField('title'), 
62
            ORM_StringField('description'), 
63
            ORM_StringField('action'), 
64
            ORM_StringField('imagePath'), 
65
            ORM_BoolField('seen')
66
        );
67
    }
68
    
69
    public function selectUserNotifications($user = null, $seen = false)
70
    {
71
        if(! isset($user)){
72
            $App = $this->App();
73
            $user = $App->getCurrentUser();
74
        }
75
        
76
        return $this->select($this->user->is($user)->_AND_($this->seen->is($seen)));
0 ignored issues
show
The call to Capwelton\LibApp\Set\AppNotificationSet::select() has too many arguments starting with $this->user->is($user)->...$this->seen->is($seen)). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

76
        return $this->/** @scrutinizer ignore-call */ select($this->user->is($user)->_AND_($this->seen->is($seen)));

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
77
    }
78
}