Passed
Push — master ( e3d02e...b8a1dc )
by Michael
03:24 queued 12s
created

Headline::cacheExpired()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace XoopsModules\Xoopsheadline;
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
 * @copyright    XOOPS Project https://xoops.org/
17
 * @license      GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
18
 * @package
19
 * @since
20
 * @author       XOOPS Development Team, Kazumi Ono (AKA onokazu)
21
 */
22
23
/**
24
 * Class Headline
25
 */
26
class Headline extends \XoopsObject
27
{
28
    /**
29
     * Headline constructor.
30
     */
31
    public function __construct()
32
    {
33
        parent::__construct();
34
        $this->initVar('headline_id', \XOBJ_DTYPE_INT, null, false);
35
        $this->initVar('headline_name', \XOBJ_DTYPE_TXTBOX, null, true, 255);
36
        $this->initVar('headline_url', \XOBJ_DTYPE_TXTBOX, null, true, 255);
37
        $this->initVar('headline_rssurl', \XOBJ_DTYPE_TXTBOX, null, true, 255);
38
        $this->initVar('headline_cachetime', \XOBJ_DTYPE_INT, 600, false);
39
        $this->initVar('headline_asblock', \XOBJ_DTYPE_INT, 0, false);
40
        $this->initVar('headline_display', \XOBJ_DTYPE_INT, 0, false);
41
        $this->initVar('headline_encoding', \XOBJ_DTYPE_OTHER, null, false);
42
        $this->initVar('headline_weight', \XOBJ_DTYPE_INT, 0, false);
43
        $this->initVar('headline_mainimg', \XOBJ_DTYPE_INT, 1, false);
44
        $this->initVar('headline_mainfull', \XOBJ_DTYPE_INT, 1, false);
45
        $this->initVar('headline_mainmax', \XOBJ_DTYPE_INT, 10, false);
46
        $this->initVar('headline_blockimg', \XOBJ_DTYPE_INT, 0, false);
47
        $this->initVar('headline_blockmax', \XOBJ_DTYPE_INT, 10, false);
48
        $this->initVar('headline_xml', \XOBJ_DTYPE_SOURCE, null, false);
49
        $this->initVar('headline_updated', \XOBJ_DTYPE_INT, 0, false);
50
    }
51
52
    /**
53
     * @return bool
54
     */
55
    public function cacheExpired()
56
    {
57
        if (\time() - $this->getVar('headline_updated') > $this->getVar('headline_cachetime')) {
58
            return true;
59
        }
60
61
        return false;
62
    }
63
}
64