| Conditions | 3 |
| Paths | 3 |
| Total Lines | 36 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 27 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 39 | 9 | public function generate() |
|
| 40 | { |
||
| 41 | 9 | $this->prepareData($this->data); |
|
| 42 | |||
| 43 | 9 | foreach ($this->data['columns'] as $column) { |
|
| 44 | 9 | $field = strtolower($column->getField()); |
|
| 45 | |||
| 46 | 9 | $this->data['camel'][$field] = $this->transformField( |
|
| 47 | 9 | $field, |
|
| 48 | 3 | 'camelize' |
|
| 49 | 6 | ); |
|
| 50 | |||
| 51 | 9 | $this->data['underscore'][$field] = $this->transformField( |
|
| 52 | 9 | $field, |
|
| 53 | 3 | 'underscore' |
|
| 54 | 6 | ); |
|
| 55 | |||
| 56 | 9 | if ($column->isForeignKey()) { |
|
| 57 | 9 | $field = $column->getField(); |
|
| 58 | 9 | $referencedTable = $column->getReferencedTable(); |
|
| 59 | |||
| 60 | 9 | array_push($this->data['indexes'], $field); |
|
| 61 | |||
| 62 | 9 | $this->data = $this->getPrimaryKey( |
|
| 63 | 9 | $this->data, |
|
| 64 | 9 | $field, |
|
| 65 | 3 | $referencedTable |
|
| 66 | 6 | ); |
|
| 67 | 6 | } |
|
| 68 | |||
| 69 | 9 | $column->setReferencedTable( |
|
| 70 | 9 | Tools::stripTableSchema($column->getReferencedTable()) |
|
| 71 | 6 | ); |
|
| 72 | 6 | } |
|
| 73 | |||
| 74 | 9 | return $this->data; |
|
| 75 | } |
||
| 77 |