Ejemplo n.º 1
0
 /**
  * .
  *
  * @param string|array $data
  * @return string|array
  */
 public function render($data)
 {
     $variable = Container::getData()->getVariable($this->variable);
     $isNumeric = new IsNumeric($this->variable);
     if ($isNumeric->validate() == true) {
         $variable = $this->formatDelimiter($variable);
         switch ($this->form) {
             case 'numeric':
                 $return = $variable;
                 break;
             case 'ordinal':
                 $return = Ordinal::render($variable);
                 break;
             case 'long-ordinal':
                 $return = Ordinal::renderLong($variable);
                 break;
             case 'roman':
                 if (preg_match('/[A-z]/', $variable) == 0) {
                     $return = $this->calcRoman($variable);
                 } else {
                     $return = $variable;
                 }
                 break;
         }
         $return = $this->affix->render($return);
         $return = $this->display->render($return);
         $return = $this->formating->render($return);
         return $this->textCase->render($return);
     }
     return $variable;
 }
Ejemplo n.º 2
0
    /**
     * @covers Geissler\CSL\Choose\IsNumeric::__construct
     * @covers Geissler\CSL\Choose\IsNumeric::validate
     * @covers Geissler\CSL\Choose\IsNumeric::validateVariable
     */
    public function testDoNotValidate4()
    {
        $variable = 'issued edition';
        $json = '[
    {
        "issued" : 2,
        "edition": "second",
        "id": "ITEM-1",
        "type": "book"
    }
]';
        $this->initElement($variable, $json, '');
        $this->assertFalse($this->object->validate());
    }