Completed
Pull Request — master (#193)
by
unknown
09:54
created

functions.php ➔ carbon_update_comment_meta()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 5

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 4
dl 7
loc 7
ccs 0
cts 0
cp 0
crap 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use Carbon_Fields\Helper\Helper;
4
use Carbon_Fields\Updater\Updater;
5
6
if ( ! function_exists( 'carbon_get_post_meta' ) ) {
7
	function carbon_get_post_meta( $id, $name, $type = null ) {
8
		return Helper::get_post_meta( $id, $name, $type );
9
	}
10
}
11
12
if ( ! function_exists( 'carbon_get_the_post_meta' ) ) {
13
	function carbon_get_the_post_meta( $name, $type = null ) {
14
		return Helper::get_the_post_meta( $name, $type );
15
	}
16
}
17
18
if ( ! function_exists( 'carbon_get_theme_option' ) ) {
19
	function carbon_get_theme_option( $name, $type = null ) {
20
		return Helper::get_theme_option( $name, $type );
21
	}
22
}
23
24
if ( ! function_exists( 'carbon_get_term_meta' ) ) {
25
	function carbon_get_term_meta( $id, $name, $type = null ) {
26
		return Helper::get_term_meta( $id, $name, $type );
27
	}
28
}
29
30
if ( ! function_exists( 'carbon_get_user_meta' ) ) {
31
	function carbon_get_user_meta( $id, $name, $type = null ) {
32
		return Helper::get_user_meta( $id, $name, $type );
33
	}
34
}
35
36
if ( ! function_exists( 'carbon_get_comment_meta' ) ) {
37
	function carbon_get_comment_meta( $id, $name, $type = null ) {
38
		return Helper::get_comment_meta( $id, $name, $type );
39
	}
40
}
41
42 View Code Duplication
function carbon_update_post_meta( $id, $name, $value, $type = null ) {
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
	try {
44
		Updater::update_field( 'post_meta', $id, $name, $value, $type );	
45
	} catch( Exception $e ) {
46
		wp_die( $e->getMessage() );
47
	}
48
}
49
50 View Code Duplication
function carbon_update_term_meta( $id, $name, $value, $type = null ) {
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
51
	try {
52
		Updater::update_field( 'term_meta', $id, $name, $value, $type );
53
	} catch( Exception $e ) {
54
		wp_die( $e->getMessage() );
55
	}
56
}
57
58 View Code Duplication
function carbon_update_user_meta( $id, $name, $value, $type = null ) {
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
59
	try {
60
		Updater::update_field( 'user_meta', $id, $name, $value, $type );
61
	} catch( Exception $e ) {
62
		wp_die( $e->getMessage() );
63
	}
64
}
65
66 View Code Duplication
function carbon_update_comment_meta( $id, $name, $value, $type = null ) {
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
67
	try {
68
		Updater::update_field( 'comment_meta', $id, $name, $value, $type );
69
	} catch( Exception $e ) {
70
		wp_die( $e->getMessage() );
71
	}
72
}
73
74 View Code Duplication
function carbon_update_theme_option( $name, $value, $type = null ) {
0 ignored issues
show
Duplication introduced by
This function seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
75
	try {
76
		Updater::update_field( 'theme_option', null, $name, $value, $type );
77
	} catch( Exception $e ) {
78
		wp_die( $e->getMessage() );
79
	}
80
}