Completed
Branch master (55a138)
by Michael
03:21
created

Event   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 60
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 42 1
A getExternalKey() 0 4 1
1
<?php namespace XoopsModules\Extcal;
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 33 and the first side effect is on line 23.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright    {@link https://xoops.org/ XOOPS Project}
14
 * @license      {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @package      extcal
16
 * @since
17
 * @author       XOOPS Development Team,
18
 */
19
20
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% 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...
21
22
 // require_once __DIR__ . '/ExtcalPersistableObjectHandler.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
45% 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...
23
require_once __DIR__ . '/perm.php';
24
require_once __DIR__ . '/time.php';
25
require_once __DIR__ . '/config.php';
26
require_once __DIR__ . '/extDateTime.php';
27
require_once __DIR__ . '/utility.php';
28
require_once __DIR__ . '/../include/constantes.php';
29
30
/**
31
 * Class Event.
32
 */
33
class Event extends \XoopsObject
34
{
35
    public $externalKey = [];
36
37
    /**
38
     *
39
     */
40
    public function __construct()
41
    {
42
        $this->initVar('event_id', XOBJ_DTYPE_INT, null, false);
43
        $this->initVar('cat_id', XOBJ_DTYPE_INT, null, true);
44
        $this->initVar('event_title', XOBJ_DTYPE_TXTBOX, null, true, 255);
45
        $this->initVar('event_desc', XOBJ_DTYPE_TXTAREA, '', false);
46
        $this->initVar('event_organisateur', XOBJ_DTYPE_TXTBOX, '', false);
47
        $this->initVar('event_contact', XOBJ_DTYPE_TXTBOX, '', false);
48
        $this->initVar('event_url', XOBJ_DTYPE_URL, '', false);
49
        $this->initVar('event_email', XOBJ_DTYPE_TXTBOX, '', false);
50
        $this->initVar('event_address', XOBJ_DTYPE_TXTAREA, '', false);
51
        $this->initVar('event_approved', XOBJ_DTYPE_INT, 0, false);
52
        $this->initVar('event_start', XOBJ_DTYPE_INT, null, true);
53
        $this->initVar('event_end', XOBJ_DTYPE_INT, 0, false);
54
        $this->initVar('event_submitter', XOBJ_DTYPE_INT, 0, false);
55
        $this->initVar('event_submitdate', XOBJ_DTYPE_INT, 0, false);
56
        $this->initVar('event_nbmember', XOBJ_DTYPE_INT, 0, false);
57
        $this->initVar('event_isrecur', XOBJ_DTYPE_INT, 0, false);
58
        $this->initVar('event_recur_rules', XOBJ_DTYPE_TXTBOX, null, false);
59
        $this->initVar('event_recur_start', XOBJ_DTYPE_INT, 0, false);
60
        $this->initVar('event_recur_end', XOBJ_DTYPE_INT, 0, false);
61
        $this->initVar('dohtml', XOBJ_DTYPE_INT, 0, false);
62
        $this->initVar('event_picture1', XOBJ_DTYPE_TXTBOX, null, false);
63
        $this->initVar('event_picture2', XOBJ_DTYPE_TXTBOX, null, false);
64
        //$this->initVar("event_price",XOBJ_DTYPE_OTHER,null,false,10);
0 ignored issues
show
Unused Code Comprehensibility introduced by
87% 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...
65
        $this->initVar('event_price', XOBJ_DTYPE_TXTBOX, '', false);
66
        $this->initVar('event_etablissement', XOBJ_DTYPE_INT, 5, false);
67
        $this->initVar('event_icone', XOBJ_DTYPE_TXTBOX, '', false);
68
69
        $this->externalKey['cat_id']          = [
70
            'className'      => 'Category',
71
            'getMethodeName' => 'getCat',
72
            'keyName'        => 'cat',
73
            'core'           => false,
74
        ];
75
        $this->externalKey['event_submitter'] = [
76
            'className'      => 'user',
77
            'getMethodeName' => 'get',
78
            'keyName'        => 'user',
79
            'core'           => true,
80
        ];
81
    }
82
83
    /**
84
     * @param $key
85
     *
86
     * @return mixed
87
     */
88
    public function getExternalKey($key)
89
    {
90
        return $this->externalKey[$key];
91
    }
92
}
93