TypeAddModel   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A add() 0 12 2
1
<?php
2
3
namespace Rudolf\Modules\Appearance\Menu\Type;
4
5
use Rudolf\Component\Html\Text;
6
use Rudolf\Framework\Model\AdminModel;
7
8
class TypeAddModel extends AdminModel
9
{
10
11
    public function add(array $p)
12
    {
13
        $stmt = $this->pdo->prepare("INSERT INTO {$this->prefix}menu_types SET 
14
          title = :title, description = :description, menu_type = :menu_type");
15
        $stmt->bindValue(':title', $p['title']);
16
        $stmt->bindValue(':description', $p['description']);
17
        $stmt->bindValue(':menu_type', Text::sluger(empty($p['menu_type']) ? $p['title'] : $p['menu_type']));
18
19
        $stmt->execute();
20
21
        return $this->pdo->lastInsertId();
22
    }
23
}
24