| Total Complexity | 5 |
| Total Lines | 57 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class Form extends base\Form implements Contract |
||
| 16 | { |
||
| 17 | use ContractTrait { |
||
| 18 | getLinks as getContractLinks; |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @inheritdoc |
||
| 23 | */ |
||
| 24 | protected $sectionClass = Section::class; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @inheritdoc |
||
| 28 | */ |
||
| 29 | 5 | public function getLinks() |
|
| 30 | { |
||
| 31 | 5 | $selfLink = $this->getSelfLink(); |
|
| 32 | |||
| 33 | 5 | return array_merge($this->getContractLinks(), [ |
|
| 34 | 5 | 'sections' => $selfLink . '/section', |
|
| 35 | 'curies' => [ |
||
| 36 | 5 | new Link([ |
|
| 37 | 5 | 'name' => 'embeddable', |
|
| 38 | 5 | 'href' => Url::to($selfLink, ['expand' => '{rel}']), |
|
|
|
|||
| 39 | 5 | 'title' => 'Embeddable and not Nestable related resources.', |
|
| 40 | ]), |
||
| 41 | ], |
||
| 42 | 5 | 'embeddable:sections' => 'sections', |
|
| 43 | ]); |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @inheritdoc |
||
| 48 | */ |
||
| 49 | 26 | protected function slugBehaviorConfig(): array |
|
| 50 | { |
||
| 51 | return [ |
||
| 52 | 26 | 'resourceName' => 'form', |
|
| 53 | 26 | 'checkAccess' => function ($params) { |
|
| 54 | 24 | if ( |
|
| 55 | 24 | isset($params['form_id']) |
|
| 56 | && $params['form_id'] != $this->id |
||
| 57 | 5 | ) { |
|
| 58 | 5 | throw new NotFoundHttpException( |
|
| 59 | 'Field doesnt contain the requested route.' |
||
| 60 | ); |
||
| 61 | 26 | } |
|
| 62 | }, |
||
| 63 | ]; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @inheritdoc |
||
| 68 | 5 | */ |
|
| 69 | public function extraFields() |
||
| 72 | } |
||
| 73 | } |
||
| 74 |