Ejemplo n.º 1
0
 /**
  * 年の値を4桁に調整します. (10000年問題に対応するまでの暫定的処置です.)
  * @param Map $fields 調整対象のフィールド一覧
  */
 private function adjustYear(Map $fields)
 {
     $year = $fields->get(self::$YEAR);
     $year %= 10000;
     if ($year < 0) {
         $year += 10000;
     }
     $fields->put(self::$YEAR, $year);
 }
Ejemplo n.º 2
0
 /**
  * 指定された値の繰り下がり処理を行います.
  * この関数は Time::adjust() から呼び出されます.
  * 
  * @param Map $fields 調整対象のフィールド一覧
  * @ignore
  */
 public function moveDown(Map $fields)
 {
     $key = $this->key;
     $upperKey = $this->upperKey;
     $max = $this->max;
     $min = $this->min;
     $field = $fields->get($key);
     $upperField = $fields->get($upperKey);
     $range = $max - $min + 1;
     $amount = intval(($min - $field - 1) / $range) + 1;
     $fields->put($upperKey, $upperField - $amount);
     $fields->put($key, $max - ($min - $field - 1) % $range);
 }
Ejemplo n.º 3
0
 /**
  * この要素に属性を設定します.
  * $value が設定されていない場合は, 値が省略された属性を追加します.
  * 
  * @param string $name  属性名
  * @param string $value 属性値
  */
 public function setAttribute($name, $value = null)
 {
     $cleanName = self::cleanNameString($name);
     $cleanValue = isset($value) ? self::cleanString($value) : null;
     $this->attributes->put($cleanName, $cleanValue);
 }