Passed
Push — master ( fec9db...7daaf5 )
by
unknown
03:00 queued 01:27
created

ContactForm::getPropertyTranslator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Contact;
6
7
use Yiisoft\FormModel\FormModel;
0 ignored issues
show
Bug introduced by
The type Yiisoft\FormModel\FormModel 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...
8
use Yiisoft\Input\Http\Attribute\Parameter\UploadedFiles;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Input\Http\Attri...Parameter\UploadedFiles 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
use Yiisoft\Validator\PropertyTranslator\ArrayPropertyTranslator;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Validator\Proper...ArrayPropertyTranslator 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...
10
use Yiisoft\Validator\PropertyTranslatorInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Validator\PropertyTranslatorInterface 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...
11
use Yiisoft\Validator\PropertyTranslatorProviderInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Validator\Proper...slatorProviderInterface 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...
12
use Yiisoft\Validator\Rule\Email;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Validator\Rule\Email 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...
13
use Yiisoft\Validator\Rule\Required;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Validator\Rule\Required 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...
14
use Yiisoft\Validator\RulesProviderInterface;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Validator\RulesProviderInterface 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...
15
16
final class ContactForm extends FormModel implements RulesProviderInterface, PropertyTranslatorProviderInterface
17
{
18
    private string $name = '';
0 ignored issues
show
introduced by
The private property $name is not used, and could be removed.
Loading history...
19
    private string $email = '';
0 ignored issues
show
introduced by
The private property $email is not used, and could be removed.
Loading history...
20
    private string $subject = '';
0 ignored issues
show
introduced by
The private property $subject is not used, and could be removed.
Loading history...
21
    private string $body = '';
0 ignored issues
show
introduced by
The private property $body is not used, and could be removed.
Loading history...
22
23
    #[UploadedFiles('ContactForm.attachFiles')]
24
    private array $attachFiles = [];
0 ignored issues
show
introduced by
The private property $attachFiles is not used, and could be removed.
Loading history...
25
26
    public function getPropertyLabels(): array
27
    {
28
        return [
29
            'name' => 'Name',
30
            'email' => 'Email',
31
            'subject' => 'Subject',
32
            'body' => 'Body',
33
        ];
34
    }
35
36
    public function getFormName(): string
37
    {
38
        return 'ContactForm';
39
    }
40
41
    public function getRules(): array
42
    {
43
        return [
44
            'name' => [new Required()],
45
            'email' => [new Required(), new Email()],
46
            'subject' => [new Required()],
47
            'body' => [new Required()],
48
        ];
49
    }
50
51
    public function getPropertyTranslator(): ?PropertyTranslatorInterface
52
    {
53
        return new ArrayPropertyTranslator($this->getPropertyLabels());
54
    }
55
}
56