Completed
Push — 7.x-1.x ( 2f9e3c...1070be )
by Frédéric G.
01:36
created

Unused   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 3

4 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 5 1
A checkModules() 0 7 1
A checkThemes() 0 7 1
A run() 0 8 1
1
<?php
2
3
namespace Drupal\qa\Plugin\Qa\Control\System;
4
5
use Drupal\qa\Plugin\Qa\Control\BaseControl;
6
7
/**
8
 * Find views containing PHP code
9
 */
10
class Unused extends BaseControl {
11
12
  /**
13
   * {@inheritdoc]
14
   */
15
  public function init() {
16
    $this->package_name = __NAMESPACE__;
17
    $this->title = t('Unused non-core packages');
18
    $this->description = t('Unused modules and themes present on disk can represent a useless cost on most dimensions. Packages entirely unused should usually be removed. This does not necessarily hold in a multi-site filesystem layout.');
19
  }
20
21
  /**
22
   * Identify packages entirely consisting of not-enabled modules.
23
   */
24
  function checkModules() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
25
    $ret = array(
26
      'status' => 1,
27
      'result' => array(),
28
    );
29
    return $ret;
30
  }
31
32
  /**
33
   * Identify disabled themes not used as base themes for an enabled theme.
34
   */
35
  function checkThemes() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
36
    $ret = array(
37
      'status' => 1,
38
      'result' => array(),
39
    );
40
    return $ret;
41
  }
42
43
  function run() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
44
    $pass = parent::run();
45
    $pass->record($this->checkModules());
46
    $pass->life->modify();
47
    $pass->record($this->checkThemes());
48
    $pass->life->end();
49
    return $pass;
50
  }
51
}
52