Completed
Push — master ( 85914a...2ce878 )
by Harald
06:39 queued 03:01
created

securityCheckExtended_version_check   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A pass() 0 5 2
A getMessage() 0 3 1
1
<?php
2
/*
3
  $Id$
4
5
  osCommerce, Open Source E-Commerce Solutions
6
  http://www.oscommerce.com
7
8
  Copyright (c) 2013 osCommerce
9
10
  Released under the GNU General Public License
11
*/
12
13
  use OSC\OM\OSCOM;
14
  use OSC\OM\Registry;
15
16
  class securityCheckExtended_version_check {
17
    var $type = 'warning';
18
    var $has_doc = true;
19
20
    protected $lang;
21
22
    function __construct() {
23
      $this->lang = Registry::get('Language');
24
25
      $this->lang->loadDefinitions('modules/security_check/extended/version_check');
26
27
      $this->title = MODULE_SECURITY_CHECK_EXTENDED_VERSION_CHECK_TITLE;
0 ignored issues
show
Bug introduced by
The property title does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
28
    }
29
30
    function pass() {
31
      $OSCOM_Cache = Registry::get('Cache');
32
33
      return $OSCOM_Cache->exists('core_version_check') && ($OSCOM_Cache->getTime('core_version_check') > strtotime('-30 days'));
34
    }
35
36
    function getMessage() {
37
      return '<a href="' . OSCOM::link('online_update.php') . '">' . MODULE_SECURITY_CHECK_EXTENDED_VERSION_CHECK_ERROR . '</a>';
38
    }
39
  }
40
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
41