Completed
Pull Request — master (#157)
by
unknown
01:57
created

DriverFieldPluginDrupal8Base   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMainPropertyName() 0 6 2
1
<?php
2
3
namespace Drupal\Driver\Plugin;
4
5
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
6
7
/**
8
 * Base class for Driver field plugins.
9
 */
10
class DriverFieldPluginDrupal8Base extends DriverFieldPluginBase implements DriverFieldPluginInterface, ContainerFactoryPluginInterface {
11
12
  /**
13
   * {@inheritdoc}
14
   */
15
  protected function getMainPropertyName() {
16
    if ($this->field->isConfigProperty()) {
17
      throw new \Exception("Main property name not used when processing config properties.");
18
    }
19
    return $this->field->getStorageDefinition()->getMainPropertyName();
20
  }
21
22
}
23