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

DriverFieldPluginDrupal8Base   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMainPropertyName() 0 7 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
  /**
14
   * {@inheritdoc}
15
   */
16
    protected function getMainPropertyName()
17
    {
18
        if ($this->field->isConfigProperty()) {
19
            throw new \Exception("Main property name not used when processing config properties.");
20
        }
21
        return $this->field->getStorageDefinition()->getMainPropertyName();
22
    }
23
}
24