Passed
Branch master (4407aa)
by ANTHONIUS
03:52
created

Canonicalizer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 17
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A canonicalize() 0 10 3
1
<?php
0 ignored issues
show
Coding Style introduced by
Class found in ".php" file; use ".inc" extension instead
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Coding Style introduced by
Filename "Canonicalizer.php" doesn't match the expected filename "canonicalizer.php"
Loading history...
2
0 ignored issues
show
Coding Style introduced by
You must use "/**" style comments for a file comment
Loading history...
3
/*
0 ignored issues
show
Coding Style introduced by
You must use "/**" style comments for a file comment
Loading history...
4
 * This file is part of the DoyoUserBundle project.
5
 *
6
 * (c) Anthonius Munthi <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Doyo\UserBundle\Util;
15
16
class Canonicalizer implements CanonicalizerInterface
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for class Canonicalizer
Loading history...
17
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class Canonicalizer
Loading history...
18
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $string should have a doc-comment as per coding-style.
Loading history...
19
     * @param $string
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter name
Loading history...
20
     *
21
     * @return false|mixed|string|string[]|void|null
22
     */
23 5
    public function canonicalize($string)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
Coding Style introduced by
Type hint "string" missing for
Loading history...
24
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
25 5
        if (null === $string) {
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of null please use NULL.
Loading history...
26 1
            return;
27
        }
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
28 5
        $encoding = mb_detect_encoding($string, mb_detect_order(), true);
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of true please use TRUE.
Loading history...
29
30 5
        return $encoding
31 5
            ? mb_convert_case($string, MB_CASE_LOWER, $encoding)
0 ignored issues
show
Coding Style introduced by
Expected 1 space before "?"; newline found
Loading history...
Coding Style introduced by
Inline IF statements are not allowed
Loading history...
Coding Style introduced by
Inline shorthand IF statement must be declared on a single line
Loading history...
32 5
            : mb_convert_case($string, MB_CASE_LOWER);
0 ignored issues
show
Coding Style introduced by
Expected 1 space before ":"; newline found
Loading history...
33
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end canonicalize()
Loading history...
34
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
35