Conditions | 5 |
Paths | 6 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | public function __construct(SchemaInterface $schema, $slug = false) |
||
28 | { |
||
29 | parent::__construct(); |
||
30 | $this->docset = $this->createElement('sphinx:docset'); |
||
31 | $this->appendChild($this->docset); |
||
32 | $elements = $this->createElement('sphinx:schema'); |
||
33 | |||
34 | foreach ($schema->getSchema() as $type => $list) { |
||
35 | foreach ($list as $key => $prop) { |
||
36 | $elements->appendChild($this->factoryTag($type, $key, $prop)); |
||
37 | } |
||
38 | } |
||
39 | |||
40 | if ($slug) { |
||
41 | foreach ($schema->getSluggables() as $key) { |
||
42 | $elements->appendChild($this->factoryTag('field', $key.'_slug', ['attr' => 'string'])); |
||
43 | } |
||
44 | } |
||
45 | |||
46 | $this->docset->appendChild($elements); |
||
47 | } |
||
48 | } |
||
49 |