| Total Complexity | 8 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class Sherlock |
||
| 10 | { |
||
| 11 | private $currentMetadata; |
||
|
|
|||
| 12 | |||
| 13 | 3 | public function __construct( |
|
| 17 | 3 | } |
|
| 18 | |||
| 19 | 2 | public function getOpList($entityPath) : array |
|
| 20 | { |
||
| 21 | 2 | return $this->getAll()[$entityPath]; |
|
| 22 | } |
||
| 23 | |||
| 24 | 2 | public function getAll() : array |
|
| 25 | { |
||
| 26 | 2 | $opList = []; |
|
| 27 | |||
| 28 | 2 | foreach ($this->metadata->justEntitiesMetadata() as $entityClass) { |
|
| 29 | 2 | $fields = $this->metadata->extractFields($entityClass); |
|
| 30 | |||
| 31 | 2 | $entity = StringParser::dotNotationFor($entityClass); |
|
| 32 | 2 | $opList[$entity]['fields'] = $fields; |
|
| 33 | |||
| 34 | 2 | if ($this->metadata->hasRelations()) { |
|
| 35 | 2 | $relations = $this->metadata->getRelations(); |
|
| 36 | 2 | $opList[$entity]['relations'][] = $relations; |
|
| 37 | } |
||
| 38 | } |
||
| 39 | |||
| 40 | 2 | return $opList; |
|
| 41 | } |
||
| 42 | |||
| 43 | 1 | public function getRelations($entityPath) : array |
|
| 44 | { |
||
| 45 | 1 | return current($this->getOpList($entityPath)['relations']); |
|
| 46 | } |
||
| 47 | |||
| 48 | 1 | public function getFieldsType($entityPath) : array |
|
| 60 | } |
||
| 61 | } |
||
| 62 |