stfalcon-studio / ApiBundle

@@ -0,0 +1,29 @@
Loading
1 +
<?php
2 +
/*
3 +
 * This file is part of the StfalconApiBundle.
4 +
 *
5 +
 * (c) Stfalcon LLC <stfalcon.com>
6 +
 *
7 +
 * For the full copyright and license information, please view the LICENSE
8 +
 * file that was distributed with this source code.
9 +
 */
10 +
11 +
declare(strict_types=1);
12 +
13 +
namespace StfalconStudio\ApiBundle\Util\Canonical;
14 +
15 +
/**
16 +
 * EncodingDetector.
17 +
 */
18 +
class EncodingDetector
19 +
{
20 +
    /**
21 +
     * @param string $string
22 +
     *
23 +
     * @return string|false
24 +
     */
25 +
    public function detectEncoding(string $string)
26 +
    {
27 +
        return \mb_detect_encoding($string);
28 +
    }
29 +
}

@@ -0,0 +1,48 @@
Loading
1 +
<?php
2 +
/*
3 +
 * This file is part of the StfalconApiBundle.
4 +
 *
5 +
 * (c) Stfalcon LLC <stfalcon.com>
6 +
 *
7 +
 * For the full copyright and license information, please view the LICENSE
8 +
 * file that was distributed with this source code.
9 +
 */
10 +
11 +
declare(strict_types=1);
12 +
13 +
namespace StfalconStudio\ApiBundle\Util\Canonical;
14 +
15 +
/**
16 +
 * Canonicalizer.
17 +
 */
18 +
class Canonicalizer
19 +
{
20 +
    /** @var EncodingDetector */
21 +
    private $encodingDetector;
22 +
23 +
    /**
24 +
     * @param EncodingDetector $encodingDetector
25 +
     */
26 +
    public function __construct(EncodingDetector $encodingDetector)
27 +
    {
28 +
        $this->encodingDetector = $encodingDetector;
29 +
    }
30 +
31 +
    /**
32 +
     * @param string $string
33 +
     *
34 +
     * @return string
35 +
     */
36 +
    public function canonicalize(string $string): string
37 +
    {
38 +
        $encoding = $this->encodingDetector->detectEncoding($string);
39 +
40 +
        if (\is_string($encoding)) {
41 +
            $result = \mb_convert_case($string, MB_CASE_LOWER, $encoding);
42 +
        } else {
43 +
            $result = \mb_convert_case($string, MB_CASE_LOWER);
44 +
        }
45 +
46 +
        return $result;
47 +
    }
48 +
}
Files Complexity Coverage
Annotation 12 100.00%
DTO 5 100.00%
DependencyInjection 2 100.00%
EventListener 13 100.00%
Exception 2 100.00%
Service 20 100.00%
Traits 2 100.00%
Util 12 100.00%
Entity/JWT/RefreshToken.php 3 100.00%
Event/User/AbstractUserEvent.php 2 100.00%
Request/DtoExtractor.php 5 100.00%
Security/AnonymousUser.php 7 100.00%
Serializer/Serializer.php 3 100.00%
Validator/Constraints/Password/PasswordMeetSpecialRequirementsValidator.php 5 100.00%
Project Totals (27 files) 93 100.00%
58.6
7.3=.3
TRAVIS_OS_NAME=linux
57.6
7.3=.3
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading