Exemple #1
0
    public function testObjectLists()
    {
        $actual = Output::getList(4, true, true, Output::getObject(array('read' => Output::getList(0, true, true, Output::getValue(1, false, Output::TYPE_INTEGER)), 'unread' => Output::getList(2, true, true, Output::getValue(3, false, Output::TYPE_INTEGER)))));
        $expected = <<<'EOS'
foreach ($input as $row) {
    if (isset($row[4])) {
        if (isset($row[0])) {
            $output[$row[4]]['read'][$row[0]] = (integer)$row[1];
        }

        if (isset($row[2])) {
            $output[$row[4]]['unread'][$row[2]] = (integer)$row[3];
        }
    }
}

$output = isset($output) ? array_values($output) : array();

foreach ($output as &$x0) {
    $x0['read'] = isset($x0['read']) ? array_values($x0['read']) : array();
    $x0['unread'] = isset($x0['unread']) ? array_values($x0['unread']) : array();
}
EOS;
        $this->verify($expected, $actual);
    }
Exemple #2
0
 private function readFunction()
 {
     if (!self::scanFunction(reset($this->request), $name, $arguments)) {
         return false;
     }
     switch ($name) {
         case 'get':
             return $this->getGet($this->request);
         case 'uppercase':
         case 'lowercase':
         case 'substring':
         case 'length':
         case 'plus':
         case 'minus':
         case 'times':
         case 'divides':
             if (!$this->getExpression($this->request, self::$IS_REQUIRED, $expression, $type)) {
                 return false;
             }
             /** @var AbstractExpression $expression */
             $columnId = $this->mysql->addExpression($expression);
             $isNullable = true;
             // TODO: assumption
             $this->phpOutput = Output::getValue($columnId, $isNullable, $type);
             return true;
         default:
             return false;
     }
 }