securityCheck_session_storage   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 7
lcom 0
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A pass() 0 3 2
A getMessage() 0 13 4
1
<?php
2
/**
3
  * osCommerce Online Merchant
4
  *
5
  * @copyright (c) 2016 osCommerce; https://www.oscommerce.com
6
  * @license MIT; https://www.oscommerce.com/license/mit.txt
7
  */
8
9
  use OSC\OM\FileSystem;
10
  use OSC\OM\OSCOM;
11
  use OSC\OM\Registry;
12
13
  class securityCheck_session_storage {
14
    var $type = 'warning';
15
16
    protected $lang;
17
18
    function __construct() {
19
      $this->lang = Registry::get('Language');
20
21
      $this->lang->loadDefinitions('modules/security_check/session_storage');
22
    }
23
24
    function pass() {
25
      return ((OSCOM::getConfig('store_sessions') != '') || FileSystem::isWritable(session_save_path()));
26
    }
27
28
    function getMessage() {
29
      if (OSCOM::getConfig('store_sessions') == '') {
30
        if (!is_dir(session_save_path())) {
31
          return OSCOM::getDef('warning_session_directory_non_existent', [
32
            'session_path' => session_save_path()
33
          ]);
34
        } elseif (!FileSystem::isWritable(session_save_path())) {
35
          return OSCOM::getDef('warning_session_directory_not_writeable', [
36
            'session_path' => session_save_path()
37
          ]);
38
        }
39
      }
40
    }
41
  }
42
?>
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...
43