Issues (48)

application/models/ContactUs/Row.php (4 issues)

1
<?php
2
3
/**
4
 * @copyright Bluz PHP Team
5
 * @link https://github.com/bluzphp/skeleton
6
 */
7
8
declare(strict_types=1);
9
10
namespace Application\ContactUs;
11
12
use Bluz\Validator\Traits\Validator;
0 ignored issues
show
The type Bluz\Validator\Traits\Validator 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 Bluz\Proxy\Auth;
0 ignored issues
show
The type Bluz\Proxy\Auth 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
15
/**
16
 * Options Row
17
 *
18
 * @property int $id
19
 * @property string $name
20
 * @property string $email
21
 * @property string $subject
22
 * @property string $message
23
 * @property boolean $markRead
24
 * @property boolean $markAnswered
25
 * @property string $created
26
 * @property string $updated
27
 * @property string $userId
28
 *
29
 * @category Application
30
 * @package  ContactUs
31
 */
32
class Row extends \Bluz\Db\Row
0 ignored issues
show
The type Bluz\Db\Row 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...
33
{
34
    use Validator;
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    protected function beforeSave(): void
40
    {
41
        if (!Auth::getIdentity()) {
42
            $this->addValidator('name')
43
                ->required()
44
                ->alpha(' \'');
45
            $this->addValidator('email')
46
                ->required()
47
                ->email();
48
        }
49
50
        $this->addValidator('subject')
51
            ->required()
52
            ->alpha(' \'');
53
54
        $this->addValidator('message')
55
            ->required();
56
    }
57
58
    /**
59
     * {@inheritdoc}
60
     */
61
    public function beforeInsert(): void
62
    {
63
        $this->created = gmdate('Y-m-d H:i:s');
64
65
        /* @var \Application\Users\Row $user */
66
        if ($user = Auth::getIdentity()) {
67
            $this->userId = $user->getId();
68
        } else {
69
            $this->userId = \Application\Users\Table::SYSTEM_USER;
0 ignored issues
show
The type Application\Users\Table 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...
70
        }
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    protected function beforeUpdate(): void
77
    {
78
        $this->updated = gmdate('Y-m-d H:i:s');
79
    }
80
}
81