renderFormBuilder()   A
last analyzed

Complexity

Conditions 5
Paths 3

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 8
rs 9.6111
cc 5
nc 3
nop 1
1
<?php
2
3
if (! function_exists('renderFormBuilder')) {
4
    function renderFormBuilder($uuid)
5
    {
6
        $form = \MedianetDev\BackpackForm\Models\Formbuilder::where('uniq_id', $uuid)->firstOrNew();
7
        if (empty($form) || !isset($form->uniq_id) || empty($form->uniq_id)) {
8
            return view('medianet-dev.backpack-form::render_form', ['data' => json_encode([]), 'form' => new \MedianetDev\BackpackForm\Models\Formbuilder()]);
9
        }
10
        $formData = (!empty($form->form)) ? $form->form : json_encode([]);
0 ignored issues
show
Bug introduced by
The property form does not seem to exist on MedianetDev\BackpackForm\Models\Formbuilder. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
11
        return view('medianet-dev.backpack-form::render_form', ['data' => $formData, 'form' => $form]);
12
    }
13
}
14