Exemplo n.º 1
0
 public function toArray()
 {
     $arr = ['title' => $this->title, 'class' => $this->class];
     if ($this->extensionPoints->size() > 0) {
         $arr['extension-points'] = $this->extensionPoints->toArray();
     }
     if ($this->extensions->size() > 0) {
         $extensions = [];
         foreach ($this->extensions->keys() as $key) {
             $extensions[$key] = array_map(function ($v) {
                 if (is_object($v) && method_exists($v, 'toArray')) {
                     return $v->toArray();
                 }
                 return $v;
             }, $this->extensions->get($key)->toArray());
         }
         $arr['extensions'] = $extensions;
     }
     return $arr;
 }
Exemplo n.º 2
0
 public function testArrayAccess()
 {
     $map = new Map();
     $map['a'] = 'b';
     $this->assertEquals(1, $map->size());
     $this->assertTrue($map->has('a'));
     $this->assertFalse($map->has('c'));
     $this->assertTrue($map->contains('b'));
     $this->assertFalse($map->contains('c'));
     $this->assertEquals($map['a'], $map->get('a'));
     $this->assertTrue(isset($map['a']));
     $this->assertFalse(isset($map['c']));
     $map['a'] = 'x';
     $this->assertEquals('x', $map['a']);
     unset($map['a']);
     $this->assertFalse($map->has('a'));
     $this->assertEquals(0, $map->size());
 }
Exemplo n.º 3
0
 public function size()
 {
     return $this->securities->size();
 }
Exemplo n.º 4
0
 public function size()
 {
     return $this->headers->size();
 }
Exemplo n.º 5
0
 public function size()
 {
     return $this->definitions->size();
 }
Exemplo n.º 6
0
 public function size()
 {
     return $this->schemes->size();
 }
Exemplo n.º 7
0
 public function testTextAsKey()
 {
     $map = new Map();
     $key = new Text('k');
     $map->set($key, 'val');
     $this->assertTrue($map->has($key));
     $this->assertEquals('val', $map->get($key));
     $map->remove($key);
     $this->assertEquals(0, $map->size());
 }
Exemplo n.º 8
0
 public function size()
 {
     return $this->paths->size();
 }
Exemplo n.º 9
0
 public function size()
 {
     return $this->responses->size();
 }