Passed
Push — master ( cf57bc...9eba79 )
by Michael
01:41
created

Entries   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 60
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 1
B getForm() 0 28 2
1
<?php namespace XoopsModules\Gbook;
2
3
/**
4
 * ****************************************************************************
5
 *  GBOOK - MODULE FOR XOOPS
6
 *  Copyright (c) 2007 - 2012
7
 *  Ingo H. de Boer (http://www.winshell.org)
8
 *
9
 *  This program is free software; you can redistribute it and/or modify
10
 *  it under the terms of the GNU General Public License as published by
11
 *  the Free Software Foundation; either version 2 of the License, or
12
 *  (at your option) any later version.
13
 *
14
 *  You may not change or alter any portion of this comment or credits
15
 *  of supporting developers from this source code or any supporting
16
 *  source code which is considered copyrighted (c) material of the
17
 *  original comment or credit authors.
18
 *
19
 *  This program is distributed in the hope that it will be useful,
20
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 *  GNU General Public License for more details.
23
 *  ---------------------------------------------------------------------------
24
 *
25
 * @copyright       Ingo H. de Boer (http://www.winshell.org)
26
 * @license         GNU General Public License (GPL)
27
 * @package         GBook
28
 * @author          Ingo H. de Boer ([email protected])
29
 *
30
 * ****************************************************************************
31
 */
32
33
use Xmf\Request;
0 ignored issues
show
Bug introduced by
The type Xmf\Request 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
use XoopsModules\Gbook;
35
36
/**
37
 * @package   kernel
38
 * @copyright copyright &copy; 2000 XOOPS.org
39
 */
40
class Entries extends \XoopsObject
0 ignored issues
show
Bug introduced by
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...
41
{
42
    /**
43
     * Constructor
44
     */
45
    public function __construct()
46
    {
47
        $this->initVar('id', XOBJ_DTYPE_INT, null, true);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Gbook\XOBJ_DTYPE_INT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
48
        $this->initVar('name', XOBJ_DTYPE_TXTBOX);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Gbook\XOBJ_DTYPE_TXTBOX was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
49
        $this->initVar('email', XOBJ_DTYPE_TXTBOX);
50
        $this->initVar('url', XOBJ_DTYPE_TXTBOX);
51
        $this->initVar('message', XOBJ_DTYPE_TXTAREA);
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Gbook\XOBJ_DTYPE_TXTAREA was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
52
        $this->initVar('note', XOBJ_DTYPE_TXTAREA);
53
        $this->initVar('time', XOBJ_DTYPE_INT);
54
        $this->initVar('date', XOBJ_DTYPE_TXTBOX);
55
        $this->initVar('ip', XOBJ_DTYPE_TXTBOX);
56
        $this->initVar('admin', XOBJ_DTYPE_TXTBOX);
57
58
        $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
59
        $this->initVar('dosmiley', XOBJ_DTYPE_INT, 1, false);
60
        $this->initVar('doxcode', XOBJ_DTYPE_INT, 1, false);
61
        $this->initVar('doimage', XOBJ_DTYPE_INT, 1, false);
62
        $this->initVar('dobr', XOBJ_DTYPE_INT, 1, false);
63
    }
64
65
    /**
66
     * Get {@link XoopsThemeForm} for adding/editing categories
67
     *
68
     * @param mixed $action URL to submit to or false for $_SERVER['REQUEST_URI']
69
     *
70
     * @return \XoopsThemeForm
71
     */
72
    public function getForm($action = false)
73
    {
74
        if (false === $action) {
75
            $action = Request::getString('REQUEST_URI', '', 'SERVER');
76
        }
77
        $title = _AM_GBOOK_ENTRY_EDIT;
78
79
        require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
80
        require_once dirname(__DIR__) . '/class/Utility.php';
81
82
        $form = new \XoopsThemeForm($title, 'form', $action, 'post', true);
0 ignored issues
show
Bug introduced by
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...
83
84
        $form->addElement(new \XoopsFormText(_AM_GBOOK_NAME, 'name', 35, 255, $this->getVar('name')));
0 ignored issues
show
Bug introduced by
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...
85
        $form->addElement(new \XoopsFormText(_AM_GBOOK_EMAIL, 'email', 35, 255, $this->getVar('email')));
86
        $form->addElement(new \XoopsFormText(_AM_GBOOK_URL, 'url', 35, 255, $this->getVar('url')));
87
88
        $messageEditor = Gbook\Utility::getEditor('message', $this->getVar('message', 'e'));
89
        //        $form->addElement(new \XoopsFormTextArea(_AM_GBOOK_MESSAGE, 'message', $this->getVar('message', 'e')));
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% 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...
90
        $form->addElement($messageEditor);
91
92
        $noteEditor = Gbook\Utility::getEditor('note', $this->getVar('note', 'e'));
93
        //        $form->addElement(new \XoopsFormTextArea(_AM_GBOOK_NOTE, 'note', $this->getVar('note', 'e')));
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% 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...
94
        $form->addElement($noteEditor);
95
96
        $form->addElement(new \XoopsFormHidden('op', 'save'));
0 ignored issues
show
Bug introduced by
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...
97
        $form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
0 ignored issues
show
Bug introduced by
The constant XoopsModules\Gbook\_SUBMIT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Bug introduced by
The type XoopsFormButton 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...
98
99
        return $form;
100
    }
101
}
102