示例#1
0
文件: DatePart.php 项目: geissler/csl
 /**
  * Parses the affix configuration.
  *
  * @param \SimpleXMLElement $date
  * @param array $additional Array with key form and value text or numeric
  */
 public function __construct(\SimpleXMLElement $date, array $additional)
 {
     $this->name = '';
     $this->delimiter = '–';
     $this->formatting = new Formatting($date);
     $this->textCase = new TextCase($date);
     $this->affix = new Affix($date);
     foreach ($date->attributes() as $name => $value) {
         switch ($name) {
             case 'name':
                 $this->name = (string) $value;
                 switch ($this->name) {
                     case 'day':
                         $this->render = Factory::day($additional['form'], $date);
                         break;
                     case 'month':
                         $this->render = Factory::month($additional['form'], $date);
                         break;
                     case 'year':
                         $this->render = Factory::year($additional['form'], $date);
                         break;
                 }
                 break;
             case 'range-delimiter':
                 $this->delimiter = (string) $value;
                 break;
         }
     }
 }