ErrorMessage   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 4 1
1
<?php
2
/**
3
 * This field lets you put an error message box into your backend.
4
 *
5
 * <code>
6
 * ErrorMessage::create(
7
 *    $content = 'your error'
8
 * )
9
 * </code>
10
 *
11
 * or with the optional name parameter
12
 *
13
 * <code>
14
 * ErrorMessage::create(
15
 *    $content = 'your error',
16
 *    $name = 'FieldName'
17
 * )
18
 * </code>
19
 */
20
class ErrorMessage
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
21
{
22
    /**
23
     * @var string
24
     */
25
    public static $CSSClass = 'error';
26
27
    /**
28
     * creates a message box.
29
     *
30
     * @param string $message
31
     * @param string $name (optional)
0 ignored issues
show
Documentation introduced by
Should the type for parameter $name not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
32
     *
33
     * @return MessageBoxField
34
     */
35
    public static function create($message, $name = null)
36
    {
37
        return Message::generic($message, self::$CSSClass, $name);
38
    }
39
}
40