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

Unused::checkThemes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
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