Issues (538)

programs/Set/AppCustomContainerSet.php (7 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_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...
28
use function Capwelton\LibOrm\ORM_TextField;
0 ignored issues
show
The function Capwelton\LibOrm\ORM_TextField was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
29
use function Capwelton\LibOrm\ORM_EnumField;
0 ignored issues
show
The function Capwelton\LibOrm\ORM_EnumField was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
30
use function Capwelton\LibOrm\ORM_IntField;
0 ignored issues
show
The function Capwelton\LibOrm\ORM_IntField was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
31
use Capwelton\LibOrm\Criteria\ORMCriteria;
0 ignored issues
show
The type Capwelton\LibOrm\Criteria\ORMCriteria was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
32
33
/**
34
 * @property ORMStringField $name
35
 * @property ORMStringField $fieldname
36
 * @property ORMTextField $description
37
 * @property ORMEnumField $object
38
 * @property ORMStringField $view
39
 * @property ORMTextField $fields
40
 * @property ORMStringField $classname
41
 * @property ORMStringField $sizePolicy
42
 * @property ORMEnumField $layout
43
 * @property ORMStringField $rank
44
 * @property ORMTextField $visibilityCriteria
45
 *
46
 * @method app_CustomContainer get(mixed $criteria)
47
 * @method app_CustomContainer request(mixed $criteria)
48
 * @method app_CustomContainer[] select(\ORMCriteria $criteria = null)
49
 * @method app_CustomContainer newRecord()
50
 * @method Func_App App()
51
 */
52
class AppCustomContainerSet extends AppTraceableRecordSet
53
{
54
    
55
    /**
56
     * @param Func_App $App
57
     */
58
    public function __construct(Func_App $App)
59
    {
60
        $this->setTableName("app_customcontainer");
61
        
62
        parent::__construct($App);
63
        
64
        $this->setDescription('Custom container');
65
        
66
        $this->addFields(
67
            ORM_StringField('name')->setDescription($App->translatable('Name of container used for display')), 
68
            ORM_TextField('description')->setDescription($App->translatable('Optional description')), 
69
            ORM_StringField('object')->setDescription($App->translatable('Name of object in CRM ex : Article, Contact, Organization...')), 
70
            ORM_StringField('view')->setDescription($App->translatable('The specific view')), 
71
            ORM_StringField('sizePolicy')->setDescription($App->translatable('Size policy')), 
72
            ORM_StringField('classname')->setDescription($App->translatable('Classname')), 
73
            ORM_EnumField('layout', AppCustomContainer::getLayouts())->setDescription($App->translatable('Fields layout')), 
74
            ORM_IntField('rank')->setDescription($App->translatable('Rank')), 
75
            ORM_TextField('visibilityCriteria')->setDescription($App->translatable('Visibility criteria'))
76
        );
77
    }
78
    
79
    /**
80
     * {@inheritdoc}
81
     * @see AppRecordSet::isCreatable()
82
     */
83
    public function isCreatable()
84
    {
85
        return true;
86
        return $this->App()
0 ignored issues
show
return $this->App()->Access()->administer() is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
87
            ->Access()
88
            ->administer();
89
    }
90
    
91
    /**
92
     * @return ORMCriteria
93
     */
94
    public function isReadable()
95
    {
96
        return $this->all();
97
    }
98
    
99
    /**
100
     * @return ORMCriteria
101
     */
102
    public function isUpdatable()
103
    {
104
        return $this->all();
105
        if($this->App()
0 ignored issues
show
IfNode is not reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
106
            ->Access()
107
            ->administer()){
108
            return $this->all();
109
        }
110
        return $this->none();
111
    }
112
    
113
    /**
114
     * @return ORMCriteria
115
     */
116
    public function isDeletable()
117
    {
118
        return $this->isUpdatable();
119
    }
120
}