mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-02-16 15:28:41 +00:00
Static analysis fixes
This commit is contained in:
parent
02bcc22ba2
commit
41189c8273
|
|
@ -38,7 +38,17 @@ class Navigation
|
||||||
*/
|
*/
|
||||||
public static function install(string $path = null, DatabasePool $dbPool = null) : void
|
public static function install(string $path = null, DatabasePool $dbPool = null) : void
|
||||||
{
|
{
|
||||||
$navData = \json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true);
|
$navFile = \file_get_contents(__DIR__ . '/Navigation.install.json');
|
||||||
|
|
||||||
|
if ($navFile === false) {
|
||||||
|
throw new \Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
$navData = \json_decode($navFile, true);
|
||||||
|
|
||||||
|
if ($navData === false) {
|
||||||
|
throw new \Exception();
|
||||||
|
}
|
||||||
|
|
||||||
$class = '\\Modules\\Navigation\\Admin\\Installer';
|
$class = '\\Modules\\Navigation\\Admin\\Installer';
|
||||||
/** @var $class \Modules\Navigation\Admin\Installer */
|
/** @var $class \Modules\Navigation\Admin\Installer */
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,11 @@ namespace Modules\Profile\Controller;
|
||||||
|
|
||||||
use Modules\Profile\Models\Profile;
|
use Modules\Profile\Models\Profile;
|
||||||
use Modules\Profile\Models\ProfileMapper;
|
use Modules\Profile\Models\ProfileMapper;
|
||||||
use Modules\Profile\Models\PermissionState;
|
|
||||||
use Modules\Admin\Models\AccountMapper;
|
use Modules\Admin\Models\AccountMapper;
|
||||||
|
|
||||||
use phpOMS\Account\PermissionType;
|
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
use phpOMS\Message\ResponseAbstract;
|
use phpOMS\Message\ResponseAbstract;
|
||||||
use phpOMS\Message\NotificationLevel;
|
use phpOMS\Message\NotificationLevel;
|
||||||
use phpOMS\Module\ModuleAbstract;
|
|
||||||
use phpOMS\Module\WebInterface;
|
|
||||||
use phpOMS\Views\View;
|
|
||||||
use phpOMS\Asset\AssetType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Profile class.
|
* Profile class.
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,9 @@ namespace Modules\Profile\Controller;
|
||||||
|
|
||||||
use Modules\Profile\Models\Profile;
|
use Modules\Profile\Models\Profile;
|
||||||
use Modules\Profile\Models\ProfileMapper;
|
use Modules\Profile\Models\ProfileMapper;
|
||||||
use Modules\Profile\Models\PermissionState;
|
|
||||||
use Modules\Admin\Models\AccountMapper;
|
|
||||||
|
|
||||||
use phpOMS\Account\PermissionType;
|
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
use phpOMS\Message\ResponseAbstract;
|
use phpOMS\Message\ResponseAbstract;
|
||||||
use phpOMS\Message\NotificationLevel;
|
|
||||||
use phpOMS\Module\ModuleAbstract;
|
|
||||||
use phpOMS\Module\WebInterface;
|
|
||||||
use phpOMS\Views\View;
|
use phpOMS\Views\View;
|
||||||
use phpOMS\Asset\AssetType;
|
use phpOMS\Asset\AssetType;
|
||||||
|
|
||||||
|
|
@ -50,7 +44,7 @@ class BackendController extends Controller
|
||||||
*/
|
*/
|
||||||
public function setupProfileStyles(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
public function setupProfileStyles(RequestAbstract $request, ResponseAbstract $response, $data = null) : void
|
||||||
{
|
{
|
||||||
/** @var Head $head */
|
/** @var \phpOMS\Model\Html\Head $head */
|
||||||
$head = $response->get('Content')->getData('head');
|
$head = $response->get('Content')->getData('head');
|
||||||
$head->addAsset(AssetType::CSS, '/Modules/Profile/Theme/Backend/css/styles.css');
|
$head->addAsset(AssetType::CSS, '/Modules/Profile/Theme/Backend/css/styles.css');
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +84,7 @@ class BackendController extends Controller
|
||||||
{
|
{
|
||||||
$view = new View($this->app, $request, $response);
|
$view = new View($this->app, $request, $response);
|
||||||
|
|
||||||
/** @var Head $head */
|
/** @var \phpOMS\Model\Html\Head $head */
|
||||||
$head = $response->get('Content')->getData('head');
|
$head = $response->get('Content')->getData('head');
|
||||||
$head->addAsset(AssetType::CSS, '/Modules/Calendar/Theme/Backend/css/styles.css');
|
$head->addAsset(AssetType::CSS, '/Modules/Calendar/Theme/Backend/css/styles.css');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,19 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Profile\Controller;
|
namespace Modules\Profile\Controller;
|
||||||
|
|
||||||
use Modules\Profile\Models\Profile;
|
|
||||||
use Modules\Profile\Models\ProfileMapper;
|
|
||||||
use Modules\Profile\Models\PermissionState;
|
|
||||||
use Modules\Admin\Models\AccountMapper;
|
|
||||||
|
|
||||||
use phpOMS\Account\PermissionType;
|
|
||||||
use phpOMS\Message\RequestAbstract;
|
|
||||||
use phpOMS\Message\ResponseAbstract;
|
|
||||||
use phpOMS\Message\NotificationLevel;
|
|
||||||
use phpOMS\Module\ModuleAbstract;
|
use phpOMS\Module\ModuleAbstract;
|
||||||
use phpOMS\Module\WebInterface;
|
use phpOMS\Module\WebInterface;
|
||||||
use phpOMS\Views\View;
|
|
||||||
use phpOMS\Asset\AssetType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Profile class.
|
* Profile class.
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* PHP Version 7.2
|
* PHP Version 7.2
|
||||||
*
|
*
|
||||||
* @package TBD
|
* @package Modules\Profile
|
||||||
* @copyright Dennis Eichhorn
|
* @copyright Dennis Eichhorn
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
|
|
@ -21,6 +21,14 @@ use phpOMS\DataStorage\Database\Query\Column;
|
||||||
use phpOMS\DataStorage\Database\RelationType;
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
use phpOMS\Stdlib\Base\Location;
|
use phpOMS\Stdlib\Base\Location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Address mapper.
|
||||||
|
*
|
||||||
|
* @package Modules\Profile
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://website.orange-management.de
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
class AddressMapper extends DataMapperAbstract
|
class AddressMapper extends DataMapperAbstract
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ use Modules\Media\Models\NullMedia;
|
||||||
use phpOMS\Stdlib\Base\Location;
|
use phpOMS\Stdlib\Base\Location;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account class.
|
* Profile class.
|
||||||
*
|
*
|
||||||
* @package Modules\Profile\Models
|
* @package Modules\Profile\Models
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
|
|
@ -31,16 +31,53 @@ use phpOMS\Stdlib\Base\Location;
|
||||||
*/
|
*/
|
||||||
class Profile
|
class Profile
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Id.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
private $id = 0;
|
private $id = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Profile image.
|
||||||
|
*
|
||||||
|
* @var Media
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
private $image = null;
|
private $image = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Birthday.
|
||||||
|
*
|
||||||
|
* @var \DateTime
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
private $birthday = null;
|
private $birthday = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account.
|
||||||
|
*
|
||||||
|
* @var Account
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
private $account = null;
|
private $account = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Location data.
|
||||||
|
*
|
||||||
|
* @var array<Location>
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
private $location = [];
|
private $location = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Account|null $account Account to initialize this profile with
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function __construct(Account $account = null)
|
public function __construct(Account $account = null)
|
||||||
{
|
{
|
||||||
$this->image = new NullMedia();
|
$this->image = new NullMedia();
|
||||||
|
|
@ -48,51 +85,125 @@ class Profile
|
||||||
$this->account = $account ?? new Account();
|
$this->account = $account ?? new Account();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get account id.
|
||||||
|
*
|
||||||
|
* @return int Account id
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function getId() : int
|
public function getId() : int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get account locations.
|
||||||
|
*
|
||||||
|
* @return array<Location>
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function getLocation() : array
|
public function getLocation() : array
|
||||||
{
|
{
|
||||||
return $this->location;
|
return $this->location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addLocation(Location $location)
|
/**
|
||||||
|
* Add location.
|
||||||
|
*
|
||||||
|
* @param Location $location Location
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function addLocation(Location $location) : void
|
||||||
{
|
{
|
||||||
$this->location[] = $location;
|
$this->location[] = $location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get account image.
|
||||||
|
*
|
||||||
|
* @return Media
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function getImage() : Media
|
public function getImage() : Media
|
||||||
{
|
{
|
||||||
return $this->image;
|
return $this->image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set account image.
|
||||||
|
*
|
||||||
|
* @param Media $image Profile image
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function setImage(Media $image) : void
|
public function setImage(Media $image) : void
|
||||||
{
|
{
|
||||||
$this->image = $image;
|
$this->image = $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set account.
|
||||||
|
*
|
||||||
|
* @param Account $account Profile account
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function setAccount(Account $account) : void
|
public function setAccount(Account $account) : void
|
||||||
{
|
{
|
||||||
$this->account = $account;
|
$this->account = $account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get account.
|
||||||
|
*
|
||||||
|
* @return Account
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function getAccount() : Account
|
public function getAccount() : Account
|
||||||
{
|
{
|
||||||
return $this->account ?? new NullAccount();
|
return $this->account ?? new NullAccount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set birthday.
|
||||||
|
*
|
||||||
|
* @param \DateTime $birthday Birthday
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function setBirthday(\DateTime $birthday) : void
|
public function setBirthday(\DateTime $birthday) : void
|
||||||
{
|
{
|
||||||
$this->birthday = $birthday;
|
$this->birthday = $birthday;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get birthday.
|
||||||
|
*
|
||||||
|
* @return \DateTime
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function getBirthday() : \DateTime
|
public function getBirthday() : \DateTime
|
||||||
{
|
{
|
||||||
return $this->birthday;
|
return $this->birthday;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* PHP Version 7.2
|
* PHP Version 7.2
|
||||||
*
|
*
|
||||||
* @package TBD
|
* @package Modules\Profile\Models
|
||||||
* @copyright Dennis Eichhorn
|
* @copyright Dennis Eichhorn
|
||||||
* @license OMS License 1.0
|
* @license OMS License 1.0
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
|
|
@ -23,6 +23,14 @@ use Modules\Admin\Models\Account;
|
||||||
use Modules\Admin\Models\AccountMapper;
|
use Modules\Admin\Models\AccountMapper;
|
||||||
use Modules\Calendar\Models\CalendarMapper;
|
use Modules\Calendar\Models\CalendarMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Profile mapper.
|
||||||
|
*
|
||||||
|
* @package Modules\Profile
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://website.orange-management.de
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
class ProfileMapper extends DataMapperAbstract
|
class ProfileMapper extends DataMapperAbstract
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user