refactor: add phpstan and update code to adhere to level 5

- move and refactor Image.php from Libraries to Entities folder
- update some database field names
/ types
- update composer packages
This commit is contained in:
Yassine Doghri 2021-05-12 14:00:25 +00:00
commit 231d578d64
No known key found for this signature in database
GPG key ID: 3E7F89498B960C9F
148 changed files with 11189 additions and 11421 deletions

View file

@ -8,6 +8,7 @@
namespace App\Models;
use App\Entities\Image;
use App\Entities\Person;
use CodeIgniter\Model;
@ -102,9 +103,9 @@ class PersonModel extends Model
'full_name' => $fullName,
'unique_name' => slugify($fullName),
'information_url' => $informationUrl,
'image' => download_file($image),
'created_by' => user()->id,
'updated_by' => user()->id,
'image' => new Image(download_file($image)),
'created_by' => user_id(),
'updated_by' => user_id(),
]);
return $this->insert($person);
}
@ -135,11 +136,12 @@ class PersonModel extends Model
$options = [];
$locale = service('request')->getLocale();
$cacheName = "taxonomy_options_{$locale}";
/** @var array<string, array> */
$personsTaxonomy = lang('PersonsTaxonomy.persons');
if (!($options = cache($cacheName))) {
foreach (
(array) lang('PersonsTaxonomy.persons')
as $group_key => $group
) {
foreach ($personsTaxonomy as $group_key => $group) {
foreach ($group['roles'] as $role_key => $role) {
$options[
"{$group_key},{$role_key}"