These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace hiapi\validators; |
||
4 | |||
5 | use yii\base\InvalidArgumentException; |
||
6 | use yii\helpers\Json; |
||
7 | use yii\validators\Validator; |
||
8 | |||
9 | /** |
||
10 | * Class JsonValidator |
||
11 | * |
||
12 | * @author Dmytro Naumenko <[email protected]> |
||
13 | */ |
||
14 | class JsonValidator extends Validator |
||
15 | { |
||
16 | public function __construct(array $config = []) |
||
17 | { |
||
18 | parent::__construct($config); |
||
19 | |||
20 | $this->message = '{attribute} must be a valid JSON'; |
||
21 | } |
||
22 | |||
23 | protected function validateValue($value) |
||
24 | { |
||
25 | try { |
||
26 | Json::decode($value); |
||
27 | } catch (InvalidArgumentException $e) { |
||
0 ignored issues
–
show
|
|||
28 | return [$this->message, []]; |
||
29 | } |
||
30 | } |
||
31 | } |
||
32 |
Scrutinizer analyzes your
composer.json
/composer.lock
file if available to determine the classes, and functions that are defined by your dependencies.It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.