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); }
private function readObject() { if (!self::scanObject($this->request, $object)) { return false; } $properties = array(); $initialContext = $this->context; foreach ($object as $label => $this->request) { $this->context = $initialContext; if (!$this->readExpression()) { return false; } $properties[$label] = $this->phpOutput; } $this->phpOutput = Output::getObject($properties); return true; }