This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
15
{
16
/**
17
* Handle materials by selecting batch of elements.
18
* Increase this value and got more handling speed but more memory usage.
It seems like \app\models\About::getDefaultAbout() can also be of type object<yii\db\ActiveRecord> or array. However, the property $model is declared as type object<app\models\About>. Maybe add an additional type check?
Our type inference engine has found a suspicous assignment of a value to a property.
This check raises an issue when a value that can be of a mixed type is assigned to
a property that is type hinted more strictly.
For example, imagine you have a variable $accountId that can either hold an
Id object or false (if there is no account id yet). Your code now assigns that
value to the id property of an instance of the Account class. This class
holds a proper account, so the id value must no longer be false.
Either this assignment is in error or a type check should be added for that assignment.
classId{public$id;publicfunction__construct($id){$this->id=$id;}}classAccount{/** @var Id $id */public$id;}$account_id=false;if(starsAreRight()){$account_id=newId(42);}$account=newAccount();if($accountinstanceofId){$account->id=$account_id;}
Loading history...
35
36
if (empty($this->model)) {
37
return null;
38
}
39
40
return [
41
[
42
'loc' => Url::to('/about', true),
43
'lastmod' => $this->getSitemapLastmod(),
44
'changefreq' => $this->getSitemapChangefreq(),
45
'priority' => $this->getSitemapPriority(),
46
],
47
];
48
}
49
50
/**
51
* @inheritdoc
52
*/
53
public function getSitemapItemsQuery($lang = null)
54
{
55
return null;
56
}
57
58
/**
59
* @inheritdoc
60
*/
61
public function getSitemapLoc($lang = null)
62
{
63
return Url::to('/about', true);
64
}
65
66
/**
67
* @inheritdoc
68
*/
69
public function getSitemapLastmod($lang = null)
70
{
71
return (new \DateTime($this->model->updated_at))->getTimestamp();
72
}
73
74
/**
75
* @inheritdoc
76
*/
77
public function getSitemapChangefreq($lang = null)
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.