addValues

@param TomlBuilder $tb
@param mixed       $struct
@param string|null $prefix

@return  void

@since  3.5.4
345356
protected static function addValues(TomlBuilder $tb, $struct, ?string $prefix = null): void
    {
        foreach ($struct as $key => $value) {
            if (is_array($value) && StructureHelper::isAssociativeArray($value)) {
                $tb->addTable($key = trim($prefix . '.' . $key, '.'));

                static::addValues($tb, $value, $key);
            } else {
                $tb->addValue($key, $value);
            }
        }
    }
1158779
@Override
  public void add(MtasDataItem<T1, T2> newItem) throws IOException {
    if (newItem instanceof MtasDataItemAdvanced) {
      MtasDataItemAdvanced<T1, T2> newTypedItem = (MtasDataItemAdvanced<T1, T2>) newItem;
      valueSum = operations.add11(valueSum, newTypedItem.valueSum);
      valueSumOfLogs = operations.add22(valueSumOfLogs,
          newTypedItem.valueSumOfLogs);
      valueSumOfSquares = operations.add11(valueSumOfSquares,
          newTypedItem.valueSumOfSquares);
      valueMin = operations.min11(valueMin, newTypedItem.valueMin);
      valueMax = operations.max11(valueMax, newTypedItem.valueMax);
      valueN += newTypedItem.valueN;
      recomputeComparableSortValue = true;
    } else {
      throw new IOException("can only add MtasDataItemAdvanced");
    }
  }
133426
public function insertContentObject(CreateStruct $struct, $currentVersionNo = 1)
    {
        $initialLanguageId = !empty($struct->mainLanguageId) ? $struct->mainLanguageId : $struct->initialLanguageId;
        $initialLanguageCode = $this->languageHandler->load($initialLanguageId)->languageCode;

        if (isset($struct->name[$initialLanguageCode])) {
            $name = $struct->name[$initialLanguageCode];
        } else {
            $name = '';
        }

        $q = $this->dbHandler->createInsertQuery();
        $q->insertInto(
            $this->dbHandler->quoteTable('ezcontentobject')
        )->set(
            $this->dbHandler->quoteColumn('id'),
            $this->dbHandler->getAutoIncrementValue('ezcontentobject', 'id')
        )->set(
            $this->dbHandler->quoteColumn('current_version'),
            $q->bindValue($currentVersionNo, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('name'),
            $q->bindValue($name, null, \PDO::PARAM_STR)
        )->set(
            $this->dbHandler->quoteColumn('contentclass_id'),
            $q->bindValue($struct->typeId, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('section_id'),
            $q->bindValue($struct->sectionId, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('owner_id'),
            $q->bindValue($struct->ownerId, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('initial_language_id'),
            $q->bindValue($initialLanguageId, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('remote_id'),
            $q->bindValue($struct->remoteId, null, \PDO::PARAM_STR)
        )->set(
            $this->dbHandler->quoteColumn('modified'),
            $q->bindValue(0, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('published'),
            $q->bindValue(0, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('status'),
            $q->bindValue(ContentInfo::STATUS_DRAFT, null, \PDO::PARAM_INT)
        )->set(
            $this->dbHandler->quoteColumn('language_mask'),
            $q->bindValue(
                $this->generateLanguageMask(
                    $struct->fields,
                    $initialLanguageCode,
                    $struct->alwaysAvailable
                ),
                null,
                \PDO::PARAM_INT
            )
        );

        $q->prepare()->execute();

        return $this->dbHandler->lastInsertId(
            $this->dbHandler->getSequenceName('ezcontentobject', 'id')
        );
    }
245016
public function setValue($value, $build)
    {
        $this->_value = (string) $value;
        if (isset($this->_name) && isset($this->_value)) {
            $build->setProperty($this->_name, $this->_value);
        }
    }
370863
public static function addSecond($ts = null, $num = 1)
	{
		return sfTime::add($ts, $num, sfTime::SECOND);
	}
415835
public void add(final String prefix, final String uri) {
    if (prefix == null) {
      defaultNS = uri;
    }

    addToMap(prefix, uri);
  }
1109384
private void mergeAllFieldValues(DBObject srcDBObj, DBObject tgtDBObj) {
        for (String fieldName : srcDBObj.getUpdatedFieldNames()) {
            FieldDefinition fieldDef = m_tableDef.getFieldDef(fieldName);
            if (fieldDef != null && (fieldDef.isCollection() || fieldDef.isLinkField())) {
                Set<String> newValueSet =
                    ScalarFieldUpdater.mergeMVFieldValues(tgtDBObj.getFieldValues(fieldName),
                                                          srcDBObj.getRemoveValues(fieldName),
                                                          srcDBObj.getFieldValues(fieldName));
                tgtDBObj.clearValues(fieldName);
                tgtDBObj.addFieldValues(fieldName, newValueSet);
            } else {
                tgtDBObj.clearValues(fieldName);
                tgtDBObj.addFieldValue(fieldName, srcDBObj.getFieldValue(fieldName));
            }
        }
    }
651530
void addValues(ObjectName pOName, Set<String> pReadAttributes, Set<String> pWriteAttributes, Set<String> pOperations) {
        readAttributes.put(pOName,pReadAttributes);
        writeAttributes.put(pOName,pWriteAttributes);
        operations.put(pOName,pOperations);
        if (pOName.isPattern()) {
            addPattern(pOName);
        }
    }
905453
public function addValue($mValue, $sType = ' ') {
		if (!is_array($mValue)) {
			$mValue = array($mValue);
		}
		if (!$this->mValue instanceof RuleValueList || $this->mValue->getListSeparator() !== $sType) {
			$mCurrentValue = $this->mValue;
			$this->mValue = new RuleValueList($sType, $this->iLineNo);
			if ($mCurrentValue) {
				$this->mValue->addListComponent($mCurrentValue);
			}
		}
		foreach ($mValue as $mValueItem) {
			$this->mValue->addListComponent($mValueItem);
		}
	}
218019
public static function structToString($struct, array $options = [])
    {
        $tb = new TomlBuilder();

        if ($struct instanceof \Traversable) {
            $struct = iterator_to_array($struct);
        } elseif (is_object($struct)) {
            $struct = get_object_vars($struct);
        } else {
            $struct = (array) $struct;
        }

        static::addValues($tb, $struct);

        return $tb->getTomlString();
    }
1233901
public function addValue($value)
    {
        $values = $this->getValues();
        array_push($values, $value);
        $this->setValues($values);
    }
458837
function add(Expr $next) {
		if ($this->isNull()) {
			throw new \UnexpectedValueException("Cannot add anything to NULL");
		}
		if ($this->next) {
			$this->next->add($next);
		} else {
			$this->next = $next;
		}
		return $this;
	}
973430
protected void addInvalidValues(Set<ConstraintViolation<T>> invalidValues) {
		if (invalidValues != null) {
			for (ConstraintViolation invalidValue : invalidValues) {
				results.addMessage(translateMessage(invalidValue));
			}
		}
	}
809806
public void addParameter(String paramName, String paramValue) {
        this.parameters.add(new StructureParameter(paramName, paramValue));
    }
1175430
private static void appendValue(StringBuilder sb, String item, boolean valid, long value) {
        sb.append(item).append('=');
        if (valid) {
            sb.append(value);
        } else {
            sb.append('?');
        }
    }
606775
@SuppressWarnings({ "rawtypes", "unchecked" })
    public static void setPropertiesFromThrift(String prefix, Properties properties, org.apache.thrift.TBase entity) throws Exception {
        Field field = entity.getClass().getDeclaredField("metaDataMap");
        Map<org.apache.thrift.TFieldIdEnum, org.apache.thrift.meta_data.FieldMetaData> fields = (Map<org.apache.thrift.TFieldIdEnum, FieldMetaData>) field.get(entity);
        
        for (Entry<org.apache.thrift.TFieldIdEnum, FieldMetaData> f : fields.entrySet()) { 
            ThriftTypes type = ThriftTypes.values()[f.getValue().valueMetaData.type];
            Object value = entity.getFieldValue(f.getKey());
            if (value == null)
                continue;
            
            switch (type) {
            case VOID   : 
                break;
            case BOOL   :
            case BYTE   :
            case DOUBLE :
            case I16    :
            case I32    :
            case I64    :
            case STRING :
            case ENUM   : 
                if (value instanceof byte[]) {
                    properties.put(prefix + f.getKey().getFieldName(), Base64.encodeBase64String((byte[])value));
                }
                else if (value instanceof ByteBuffer) {
                    properties.put(prefix + f.getKey().getFieldName(), base64Encode((ByteBuffer)value));
                }
                else {
                    properties.put(prefix + f.getKey().getFieldName(), value.toString());
                }
                break;
            case MAP    : {
                String newPrefix = prefix + f.getKey().getFieldName() + ".";
                org.apache.thrift.meta_data.MapMetaData meta = (org.apache.thrift.meta_data.MapMetaData)f.getValue().valueMetaData;
                if (!meta.keyMetaData.isStruct() && !meta.keyMetaData.isContainer()) {
                    Map<Object, Object> map = (Map<Object, Object>)value;
                    for (Entry<Object, Object> entry : map.entrySet()) {
                        properties.put(newPrefix + entry.getKey(), entry.getValue().toString());
                    }
                }
                else {
                    LOG.error(String.format("Unable to serializer field '%s' key type '%s' not supported", f.getKey().getFieldName(), meta.keyMetaData.getTypedefName()));
                }
                break;
            }
            case LIST   : {
                String newPrefix = prefix + f.getKey().getFieldName() + ".";

                List<Object> list = (List<Object>)value;
                org.apache.thrift.meta_data.ListMetaData listMeta = (org.apache.thrift.meta_data.ListMetaData)f.getValue().valueMetaData;
                for (Object entry : list) {
                    String id;
                    if (entry instanceof CfDef) {
                        id = ((CfDef)entry).name;
                    }
                    else if (entry instanceof ColumnDef) {
                        ByteBuffer name = ((ColumnDef)entry).name;
                        id = base64Encode(name);
                    }
                    else {
                        LOG.error("Don't know how to convert to properties " + listMeta.elemMetaData.getTypedefName());
                        continue;
                    }
                    
                    if (listMeta.elemMetaData.isStruct()) {
                        setPropertiesFromThrift(newPrefix + id + ".", properties, (org.apache.thrift.TBase)entry);
                    }
                    else {
                        properties.put(newPrefix + id, entry);
                    }
                }
                
                break;
            }
            case STRUCT : {
                setPropertiesFromThrift(prefix + f.getKey().getFieldName() + ".", properties, (org.apache.thrift.TBase)value);
                break;
            }
            case SET    :
            default:
                LOG.error("Unhandled value : " + f.getKey().getFieldName() + " " + type);
                break;
            }
        }
24572
private void addPiece(String pc, String prefix, StringBuilder sb) {
        if (!pc.isEmpty()) {
            if (sb.length() > 0) {
                sb.append(prefix);
            }
            
            sb.append(pc);
        }
    }