Validation   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 21
ccs 0
cts 8
cp 0
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Canvas;
6
7
use Canvas\Http\Exception\UnprocessableEntityException;
8
use Phalcon\Validation as PhalconValidation;
0 ignored issues
show
Bug introduced by
The type Phalcon\Validation was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * Class Validation.
12
 *
13
 * @package Canvas
14
 */
15
class Validation extends PhalconValidation
16
{
17
    /**
18
     *
19
     * Overwrite to throw the exception and avoid all the overloaded code
20
     * Validate a set of data according to a set of rules.
21
     *
22
     * @param array|object data
0 ignored issues
show
Bug introduced by
The type Canvas\data was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
     * @param object entity
0 ignored issues
show
Bug introduced by
The type Canvas\entity was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
     *
25
     * @return \Phalcon\Validation\Message\Group
0 ignored issues
show
Bug introduced by
The type Phalcon\Validation\Message\Group was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
26
     */
27
    public function validate($data = null, $entity = null)
28
    {
29
        $validate = parent::validate($data, $entity);
30
31
        if (count($validate)) {
32
            throw new UnprocessableEntityException($validate[0]->getMessage());
33
        }
34
35
        return $validate;
36
    }
37
}
38