Issues (584)

class/Requests.php (23 issues)

1
<?php
2
3
namespace XoopsModules\Wggithub;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
15
/**
16
 * wgGitHub module for xoops
17
 *
18
 * @copyright      2020 XOOPS Project (https://xooops.org)
19
 * @license        GPL 2.0 or later
20
 * @package        wggithub
21
 * @since          1.0
22
 * @min_xoops      2.5.10
23
 * @author         TDM XOOPS - Email:<[email protected]> - Website:<https://wedega.com>
24
 */
25
26
use XoopsModules\Wggithub;
27
28
\defined('\XOOPS_ROOT_PATH') || die('Restricted access');
29
30
/**
31
 * Class Object Requests
32
 */
33
class Requests extends \XoopsObject
0 ignored issues
show
The type XoopsObject 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...
34
{
35
    /**
36
     * Constructor
37
     *
38
     * @param null
39
     */
40
    public function __construct()
41
    {
42
        $this->initVar('req_id', \XOBJ_DTYPE_INT);
0 ignored issues
show
The constant XOBJ_DTYPE_INT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
43
        $this->initVar('req_request', \XOBJ_DTYPE_TXTBOX);
0 ignored issues
show
The constant XOBJ_DTYPE_TXTBOX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
44
        $this->initVar('req_result', \XOBJ_DTYPE_TXTBOX);
45
        $this->initVar('req_datecreated', \XOBJ_DTYPE_INT);
46
        $this->initVar('req_submitter', \XOBJ_DTYPE_INT);
47
    }
48
49
    /**
50
     * @static function &getInstance
51
     *
52
     * @param null
53
     */
54
    public static function getInstance()
55
    {
56
        static $instance = false;
57
        if (!$instance) {
58
            $instance = new self();
59
        }
60
    }
61
62
    /**
63
     * The new inserted $Id
64
     * @return inserted id
0 ignored issues
show
The type XoopsModules\Wggithub\inserted 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...
65
     */
66
    public function getNewInsertedIdRequests()
67
    {
68
        $newInsertedId = $GLOBALS['xoopsDB']->getInsertId();
69
        return $newInsertedId;
70
    }
71
72
    /**
73
     * @public function getForm
74
     * @param bool $action
75
     * @return \XoopsThemeForm
76
     */
77
    public function getFormRequests($action = false)
78
    {
79
        if (!$action) {
80
            $action = $_SERVER['REQUEST_URI'];
81
        }
82
        // Title
83
        $title = $this->isNew() ? \sprintf(\_AM_WGGITHUB_REQUEST_ADD) : \sprintf(\_AM_WGGITHUB_REQUEST_EDIT);
0 ignored issues
show
The constant _AM_WGGITHUB_REQUEST_ADD was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The constant _AM_WGGITHUB_REQUEST_EDIT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
84
        // Get Theme Form
85
        \xoops_load('XoopsFormLoader');
0 ignored issues
show
The function xoops_load was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

85
        /** @scrutinizer ignore-call */ 
86
        \xoops_load('XoopsFormLoader');
Loading history...
86
        $form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
0 ignored issues
show
The type XoopsThemeForm 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...
87
        $form->setExtra('enctype="multipart/form-data"');
88
        // Form Text reqRequest
89
        $form->addElement(new \XoopsFormText(\_AM_WGGITHUB_REQUEST_REQUEST, 'req_request', 50, 255, $this->getVar('req_request')), true);
0 ignored issues
show
The constant _AM_WGGITHUB_REQUEST_REQUEST was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The type XoopsFormText 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...
90
        // Form Text reqResult
91
        $form->addElement(new \XoopsFormText(\_AM_WGGITHUB_REQUEST_RESULT, 'req_result', 50, 255, $this->getVar('req_result')));
0 ignored issues
show
The constant _AM_WGGITHUB_REQUEST_RESULT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
92
        // Form Text Date Select reqDatecreated
93
        $reqDatecreated = $this->isNew() ?: $this->getVar('req_datecreated');
94
        $form->addElement(new \XoopsFormTextDateSelect(\_AM_WGGITHUB_REQUEST_DATECREATED, 'req_datecreated', '', $reqDatecreated));
0 ignored issues
show
The type XoopsFormTextDateSelect 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...
The constant _AM_WGGITHUB_REQUEST_DATECREATED was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
95
        // Form Select User reqSubmitter
96
        $form->addElement(new \XoopsFormSelectUser(\_AM_WGGITHUB_REQUEST_SUBMITTER, 'req_submitter', false, $this->getVar('req_submitter')));
0 ignored issues
show
The type XoopsFormSelectUser 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...
The constant _AM_WGGITHUB_REQUEST_SUBMITTER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
97
        // To Save
98
        $form->addElement(new \XoopsFormHidden('op', 'save'));
0 ignored issues
show
The type XoopsFormHidden 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...
99
        $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false));
0 ignored issues
show
The type XoopsFormButtonTray 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...
The constant XoopsModules\Wggithub\_SUBMIT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
100
        return $form;
101
    }
102
103
    /**
104
     * Get Values
105
     * @param null $keys
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $keys is correct as it would always require null to be passed?
Loading history...
106
     * @param null $format
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $format is correct as it would always require null to be passed?
Loading history...
107
     * @param null $maxDepth
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $maxDepth is correct as it would always require null to be passed?
Loading history...
108
     * @return array
109
     */
110
    public function getValuesRequests($keys = null, $format = null, $maxDepth = null)
111
    {
112
        $ret = $this->getValues($keys, $format, $maxDepth);
113
        $ret['id']          = $this->getVar('req_id');
114
        $ret['request']     = $this->getVar('req_request');
115
        $ret['result']      = $this->getVar('req_result');
116
        $ret['datecreated'] = \formatTimestamp($this->getVar('req_datecreated'), 's');
0 ignored issues
show
The function formatTimestamp was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

116
        $ret['datecreated'] = /** @scrutinizer ignore-call */ \formatTimestamp($this->getVar('req_datecreated'), 's');
Loading history...
117
        $ret['submitter']   = \XoopsUser::getUnameFromId($this->getVar('req_submitter'));
0 ignored issues
show
The type XoopsUser 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...
118
        return $ret;
119
    }
120
121
    /**
122
     * Returns an array representation of the object
123
     *
124
     * @return array
125
     */
126
    public function toArrayRequests()
127
    {
128
        $ret = [];
129
        $vars = $this->getVars();
130
        foreach (\array_keys($vars) as $var) {
131
            $ret[$var] = $this->getVar('"{$var}"');
132
        }
133
        return $ret;
134
    }
135
}
136