_values = explode($fieldData['separator'], $fieldData['value']); } else { $this->_values = [$fieldData['value']]; } $fieldId = $fieldPrefix . (isset( $fieldData['dependPath'] ) && is_array( $fieldData['dependPath'] ) ? array_pop( $fieldData['dependPath'] ) : ''); $fieldData['dependPath'][] = $fieldId; $this->_id = implode('_', $fieldData['dependPath']); $this->_isNegative = isset($fieldData['negative']) && $fieldData['negative']; } /** * Check whether the value satisfy dependency * * @param string $value * @return bool */ public function isValueSatisfy($value) { return in_array($value, $this->_values) xor $this->_isNegative; } /** * Get id of the dependent field * * @return string */ public function getId() { return $this->_id; } /** * Get values for dependence * * @return string[] */ public function getValues() { return $this->_values; } /** * Get negative indication of dependency * * @return bool */ public function isNegative() { return $this->_isNegative; } }