<?php
namespace nur\ldap;

use nur\b\coll\TArrayMd;

trait TCompositeValue {
  use TArrayMd;

  /** @var array */
  private static $optional_keys;

  protected function getOptionalKeys(): array {
    $optionalKeys = self::$optional_keys;
    if ($optionalKeys === null) {
      $optionalKeys = self::$optional_keys = parent::getOptionalKeys();
    }
    return $optionalKeys;
  }

  function reset(?array $values): CompositeValue {
    $this->md()->ensureSchema($values);
    $this->data = $values;
    return $this;
  }
}