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

getMainPropertyName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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