1 | <?php |
||
2 | |||
3 | namespace andmemasin\language\models; |
||
4 | |||
5 | |||
6 | use andmemasin\myabstract\Settings; |
||
7 | use andmemasin\myabstract\WithLanguagesInterface; |
||
8 | use andmemasin\surveyapp\models\SurveyLanguagesettingType; |
||
0 ignored issues
–
show
|
|||
9 | use yii\base\InvalidConfigException; |
||
10 | use yii\base\UserException; |
||
11 | |||
12 | |||
13 | /** |
||
14 | * Class BaseLanguageSettings |
||
15 | * @package andmemasin\language\models |
||
16 | * @author Tõnis Ormisson <[email protected]> |
||
17 | */ |
||
18 | class BaseLanguageSettings extends Settings |
||
19 | { |
||
20 | /** @var BaseLanguageSetting[] */ |
||
21 | public $settings; |
||
22 | |||
23 | /** @var array */ |
||
24 | public $settingsData = []; |
||
25 | |||
26 | /** @var WithLanguagesInterface */ |
||
27 | public $parent; |
||
28 | |||
29 | public $typeClass = SurveyLanguagesettingType::class; |
||
30 | |||
31 | |||
32 | /** @var Language */ |
||
33 | public $language; |
||
34 | |||
35 | /** {@inheritdoc} */ |
||
36 | public function init() |
||
37 | { |
||
38 | parent::init(); |
||
39 | |||
40 | if (!$this->parent) { |
||
41 | throw new InvalidConfigException('Parent Model must be defined while initiating languages-settings'); |
||
42 | } |
||
43 | |||
44 | if (!$this->parent instanceof WithLanguagesInterface) { |
||
45 | throw new InvalidConfigException('Parent Model must implement WithLanguagesInterface'); |
||
46 | } |
||
47 | } |
||
48 | |||
49 | /** {@inheritdoc} */ |
||
50 | public function save($runValidation = true, $attributeNames = NULL){ |
||
51 | if(!empty($this->settings)){ |
||
52 | foreach ($this->settings as $key=> $setting){ |
||
53 | // delete empty |
||
54 | if($setting->value === null || $setting->value === ''){ |
||
55 | if(!$setting->isNewRecord){ |
||
56 | $setting->delete(); |
||
57 | } |
||
58 | } else { |
||
59 | if (!$setting->save($runValidation, $attributeNames)) { |
||
60 | throw new UserException(serialize($setting->errors)); |
||
61 | } |
||
62 | |||
63 | $this->settings[$key] = $setting; |
||
64 | $this->addErrors($setting->errors); |
||
65 | } |
||
66 | |||
67 | } |
||
68 | } |
||
69 | |||
70 | return empty($this->errors); |
||
71 | } |
||
72 | |||
73 | } |
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