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

getMainPropertyName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
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
  /**
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