public function testReturnsMember() { $s = new ListShape(['member' => ['type' => 'string']], new ShapeMap([])); $m = $s->getMember(); $this->assertInstanceOf('Vws\\Api\\Shape', $m); $this->assertSame($m, $s->getMember()); $this->assertEquals('string', $m->getType()); }
private function check_list(ListShape $shape, $value) { if (!is_array($value)) { $this->addError('must be an array. Found ' . Vws\describe_type($value)); return; } list($min, $max, $count) = [$shape['min'], $shape['max'], count($value)]; if ($min && $count < $min) { $this->addError("must have at least {$min} members." . " Value provided has {$count}."); } if ($max && $count > $max) { $this->addError("must have no more than {$max} members." . " Value provided has {$count}."); } $items = $shape->getMember(); foreach ($value as $index => $v) { $this->path[] = $index; $this->dispatch($items, $v); array_pop($this->path); } }