| Total Complexity | 8 |
| Total Lines | 84 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | class ConfigEntityField implements DocumentFieldInterface |
||
| 6 | { |
||
| 7 | |||
| 8 | /** |
||
| 9 | * @var int |
||
| 10 | */ |
||
| 11 | private $priority; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var string |
||
| 15 | */ |
||
| 16 | private $configFieldName; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $documentFieldName; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var bool |
||
| 25 | */ |
||
| 26 | private $discriminator; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param string $configFieldName |
||
| 30 | * @param string $documentFieldName |
||
| 31 | * @param bool $discriminator |
||
| 32 | * @param int $priority |
||
| 33 | */ |
||
| 34 | public function __construct($configFieldName, $documentFieldName, $discriminator, $priority) |
||
| 35 | { |
||
| 36 | $this->configFieldName = $configFieldName; |
||
| 37 | $this->documentFieldName = $documentFieldName; |
||
| 38 | $this->discriminator = $discriminator; |
||
| 39 | $this->priority = $priority; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @return string |
||
| 44 | */ |
||
| 45 | public function getConfigFieldName() |
||
| 46 | { |
||
| 47 | return $this->configFieldName; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return string |
||
| 52 | */ |
||
| 53 | public function getDocumentFieldName() |
||
| 54 | { |
||
| 55 | return $this->documentFieldName; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @param array $entityConfig |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public function getValue($entityConfig) |
||
| 63 | { |
||
| 64 | $configFieldValue = ''; |
||
| 65 | foreach ($entityConfig['config'] as $config) { |
||
| 66 | if ($config['name'] == $this->getConfigFieldName()) { |
||
| 67 | $configFieldValue = $config['value']; |
||
| 68 | break; |
||
| 69 | } |
||
| 70 | } |
||
| 71 | |||
| 72 | return $configFieldValue; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @return boolean |
||
| 77 | */ |
||
| 78 | public function isDiscriminator() |
||
| 81 | } |
||
| 82 | |||
| 83 | /** |
||
| 84 | * @return int |
||
| 85 | */ |
||
| 86 | public function getPriority() |
||
| 89 | } |
||
| 90 | } |