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

BasePackage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getInstance() 0 7 2
1
<?php
2
3
namespace Drupal\qa\Plugin\Qa\Control;
4
5
use Drupal\qa\Exportable;
6
7
/**
8
 * An instantiable Exportable.
9
 */
10
abstract class BasePackage extends Exportable {
11
12
  protected static $instances = array();
13
14
  public static function getInstance() {
15
    $name = get_called_class();
16
    if (!isset(self::$instances[$name])) {
17
      self::$instances[$name] = new $name();;
18
    }
19
    return self::$instances[$name];
20
  }
21
22
}
23
24