GB_Meta::update
Update metadata for the specified object.
If no value already exists for the specified object
ID and metadata key, the metadata will be added.
Signature
public function update(string
$meta_type,
int
$object_id,
string
$meta_key,
mixed
$meta_value,
[string
$prev_value = ''] )
Parameters
$meta_type
—
string
Type of object metadata is for (e.g., comment, post, or user)
$object_id
—
int
ID of the object metadata is for
$meta_key
—
string
Metadata key
$meta_value
—
mixed
Metadata value. Must be serializable if non-scalar.
$prev_value
—
string
Optional. If specified, only update existing metadata entries with
the specified value. Otherwise, update all entries.
Returns
- int|bool
- Meta ID if the key didn't exist, true on successful update, false on failure.
Violations
PHPMessDetector
Line |
Rule |
Message |
316 - 446 |
CyclomaticComplexity
|
The method update() has a Cyclomatic Complexity of 15. The configured cyclomatic complexity threshold is 10. |
316 - 446 |
NPathComplexity
|
The method update() has an NPath complexity of 4096. The configured NPath complexity threshold is 200. |
316 - 446 |
ExcessiveMethodLength
|
The method update() has 131 lines of code. Current threshold is set to 100. Avoid really long methods. |
Checkstyle
Line |
Column |
Severity |
Message |
316 |
12 |
error
|
Visibility must be declared on method "update" |
347 |
11 |
error
|
Whitespace found at end of line |
361 |
128 |
warning
|
Line exceeds 120 characters; contains 128 characters |
362 |
9 |
error
|
Inline control structures are not allowed |
369 |
17 |
error
|
Inline control structures are not allowed |
374 |
126 |
warning
|
Line exceeds 120 characters; contains 126 characters |
405 |
15 |
error
|
Whitespace found at end of line |
419 |
9 |
error
|
Inline control structures are not allowed |
432 |
15 |
error
|
Whitespace found at end of line |