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

BasePackage::getInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
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;
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