MetaDataType   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 40
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
getType() 0 1 ?
A getMetaData() 0 4 1
A getAllMetaData() 0 4 1
A updateMetaData() 0 4 1
A deleteMetaData() 0 4 1
1
<?php
2
3
namespace StoutLogic\ACF\Migrations;
4
5
abstract class MetaDataType implements HasMetaData
6
{
7
    /**
8
     * @var int
9
     */
10
    private $id;
11
12
    /**
13
     * @param int $id
14
     */
15
    public function __construct($id)
16
    {
17
        $this->id = $id;
18
    }
19
20
    /**
21
     * @return string
22
     */
23
    abstract public function getType();
24
25
    public function getMetaData($key = '')
26
    {
27
        return get_metadata($this->getType(), $this->id, $key);
28
    }
29
30
    public function getAllMetaData()
31
    {
32
        return $this->getMetaData();
33
    }
34
35
    public function updateMetaData($key, $value, $oldValue = '')
36
    {
37
        return update_metadata($this->getType(), $this->id, $key, $value, $oldValue);
38
    }
39
40
    public function deleteMetaData($key)
41
    {
42
        return delete_metadata($this->getType(), $this->id, $key);
43
    }
44
}