GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — integration (#2604)
by Brendan
05:28
created

Requirements   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 91
Duplicated Lines 19.78 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 5
Bugs 1 Features 2
Metric Value
c 5
b 1
f 2
dl 18
loc 91
rs 10
wmc 13
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
F check() 18 85 13

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/**
4
 * @package install
5
 */
6
namespace SymphonyCms\Installer\Lib;
7
8
class Requirements
9
{
10
    /**
11
     * @return array
12
     */
13
    public function check()
14
    {
15
        $errors = array();
16
17
        // Check for PHP 5.4+
18
        if (version_compare(phpversion(), '5.5.9', '<=')) {
19
            $errors[] = array(
20
                'msg' => __('PHP Version is not correct'),
21
                'details' => __(
22
                    'Symphony requires %1$s or greater to work, however version %2$s was detected.',
23
                    array(
24
                        '<code><abbr title="PHP: Hypertext Pre-processor">PHP</abbr> 5.5.9</code>',
25
                        '<code>' . phpversion() . '</code>'
26
                    )
27
                )
28
            );
29
        }
30
31
        // Is PDO available?
32 View Code Duplication
        if (!extension_loaded('pdo')) {
33
            $errors[] = array(
34
                'msg' => __('PDO extension not present'),
35
                'details' => __('Symphony requires PHP to be configured with PDO to work.')
36
            );
37
        }
38
39
        // Is CURL available?
40 View Code Duplication
        if (!extension_loaded('curl')) {
41
            $errors[] = array(
42
                'msg' => __('CURL extension not present'),
43
                'details' => __('Symphony requires PHP to be configured with CURL for HTTP communication.')
44
            );
45
        }
46
47
        // Is libxml available?
48 View Code Duplication
        if (!extension_loaded('xml') && !extension_loaded('libxml')) {
49
            $errors[] = array(
50
                'msg' => __('XML extension not present'),
51
                'details' => __('Symphony needs the XML extension to pass data to the site frontend.')
52
            );
53
        }
54
55
        // Is libxslt available?
56
        if (!extension_loaded('xsl') && !extension_loaded('xslt') && !function_exists('domxml_xslt_stylesheet')) {
57
            $errors[] = array(
58
                'msg' => __('XSLT extension not present'),
59
                'details' => __(
60
                    'Symphony needs an XSLT processor such as %s or Sablotron to build pages.',
61
                    array('Lib<abbr title="eXtensible Stylesheet Language Transformation">XSLT</abbr>')
62
                )
63
            );
64
        }
65
66
        // Is json_encode available?
67
        if (!function_exists('json_decode')) {
68
            $errors[] = array(
69
                'msg' => __('JSON functionality is not present'),
70
                'details' => __('Symphony uses JSON functionality throughout the backend for translations and the interface.')
71
            );
72
        }
73
74
        // Cannot write to root folder.
75
        if (!is_writable(DOCROOT)) {
76
            $errors['no-write-permission-root'] = array(
77
                'msg' => 'Root folder not writable: ' . DOCROOT,
78
                'details' => __(
79
                    'Symphony does not have write permission to the root directory. Please modify permission settings on %s. This can be reverted once installation is complete.',
80
                    array('<code>' . DOCROOT . '</code>')
81
                )
82
            );
83
        }
84
85
        // Cannot write to workspace
86
        if (is_dir(DOCROOT . '/workspace') && !is_writable(DOCROOT . '/workspace')) {
87
            $errors['no-write-permission-workspace'] = array(
88
                'msg' => 'Workspace folder not writable: ' . DOCROOT . '/workspace',
89
                'details' => __(
90
                    'Symphony does not have write permission to the existing %1$s directory. Please modify permission settings on this directory and its contents to allow this, such as with a recursive %2$s command.',
91
                    array('<code>/workspace</code>', '<code>chmod -R</code>')
92
                )
93
            );
94
        }
95
96
        return $errors;
97
    }
98
}
99