bluzphp /
module-options
| 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\Options; |
||
| 11 | |||
| 12 | use Bluz\Proxy\Auth; |
||
|
0 ignored issues
–
show
|
|||
| 13 | 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 14 | use Application\Users; |
||
|
0 ignored issues
–
show
The type
Application\Users 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 15 | |||
| 16 | /** |
||
| 17 | * Options Row |
||
| 18 | * |
||
| 19 | * @package Application\Options |
||
| 20 | * |
||
| 21 | * @property string $namespace |
||
| 22 | * @property string $key |
||
| 23 | * @property integer $userId |
||
| 24 | * @property string $value |
||
| 25 | * @property string $description |
||
| 26 | * @property string $created |
||
| 27 | * @property string $updated |
||
| 28 | * |
||
| 29 | * @OA\Schema(schema="option", title="option", required={"namespace", "key"}) |
||
| 30 | * @OA\Property(property="namespace", type="string", description="Options namespace", example="default") |
||
| 31 | * @OA\Property(property="key", type="string", description="Key", example="Some key") |
||
| 32 | * @OA\Property(property="userId", type="integer", description="Author ID", example=2) |
||
| 33 | * @OA\Property(property="value", type="string", description="Value", example="Some Value") |
||
| 34 | * @OA\Property(property="description", type="string", description="Description", example="Some description for key") |
||
| 35 | * @OA\Property(property="created", type="string", format="date-time", description="Created date", |
||
| 36 | * example="2017-03-17 19:06:28") |
||
| 37 | * @OA\Property(property="updated", type="string", format="date-time", description="Last updated date", |
||
| 38 | * example="2017-03-17 19:06:28") |
||
| 39 | */ |
||
| 40 | 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 41 | { |
||
| 42 | use Validator; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * {@inheritdoc} |
||
| 46 | */ |
||
| 47 | protected function afterRead(): void |
||
| 48 | { |
||
| 49 | if ($this->value) { |
||
| 50 | $this->value = unserialize($this->value, ['allowed_classes' => false]); |
||
| 51 | } |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * {@inheritdoc} |
||
| 56 | */ |
||
| 57 | protected function beforeSave(): void |
||
| 58 | { |
||
| 59 | $this->value = serialize($this->value); |
||
| 60 | |||
| 61 | $this->addValidator('namespace') |
||
| 62 | ->required() |
||
| 63 | ->slug(); |
||
| 64 | $this->addValidator('key') |
||
| 65 | ->required() |
||
| 66 | ->slug(); |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * {@inheritdoc} |
||
| 71 | */ |
||
| 72 | protected function beforeInsert(): void |
||
| 73 | { |
||
| 74 | // unique validator |
||
| 75 | $this->addValidator('key') |
||
| 76 | ->callback( |
||
| 77 | function () { |
||
| 78 | return !$this->getTable()->findRowWhere(['key' => $this->key, 'namespace' => $this->namespace]); |
||
| 79 | }, |
||
| 80 | 'Key name is already exists' |
||
| 81 | ); |
||
| 82 | |||
| 83 | /* @var Users\Row $user */ |
||
| 84 | if ($user = Auth::getIdentity()) { |
||
| 85 | $this->userId = $user->getId(); |
||
| 86 | } else { |
||
| 87 | $this->userId = 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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 88 | } |
||
| 89 | } |
||
| 90 | |||
| 91 | /** |
||
| 92 | * {@inheritdoc} |
||
| 93 | */ |
||
| 94 | protected function beforeUpdate(): void |
||
| 95 | { |
||
| 96 | $this->updated = gmdate('Y-m-d H:i:s'); |
||
| 97 | } |
||
| 98 | } |
||
| 99 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths