diff --git a/com_oauthserver/administrator/src/Model/AccessTokenModel.php b/com_oauthserver/administrator/src/Model/AccessTokenModel.php index c263682..a37b9d1 100644 --- a/com_oauthserver/administrator/src/Model/AccessTokenModel.php +++ b/com_oauthserver/administrator/src/Model/AccessTokenModel.php @@ -1,21 +1,37 @@ + * @license MIT; see LICENSE.txt + **/ namespace Webmasterskaya\Component\OauthServer\Administrator\Model; use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; use Joomla\CMS\MVC\Model\AdminModel; +use Joomla\CMS\Table\Table; +use Webmasterskaya\Component\OauthServer\Administrator\Table\AccessTokenTable; + +\defined('_JEXEC') or die; class AccessTokenModel extends AdminModel implements RevokedModelInterface { use GetItemByIdentifierTrait; use RevokedModelTrait; + /** + * @inheritdoc + * @since version + */ public function getForm($data = [], $loadData = true): Form|bool { $form = $this->loadForm('com_oauthserver.access_token', 'access_token', ['control' => 'jform', 'load_data' => $loadData]); - if (empty($form)) { + if (empty($form)) + { return false; } @@ -23,11 +39,7 @@ class AccessTokenModel extends AdminModel implements RevokedModelInterface } /** - * Method to get the data that should be injected in the form. - * - * @return mixed The data for the form. - * - * @throws \Exception + * @inheritdoc * @since version */ protected function loadFormData(): mixed @@ -35,7 +47,8 @@ class AccessTokenModel extends AdminModel implements RevokedModelInterface // Check the session for previously entered form data. $data = Factory::getApplication()->getUserState('com_oauthserver.edit.access_token.data', []); - if (empty($data)) { + if (empty($data)) + { $data = $this->getItem(); } @@ -45,19 +58,30 @@ class AccessTokenModel extends AdminModel implements RevokedModelInterface } /** - * @param \Webmasterskaya\Component\OauthServer\Administrator\Table\AccessTokenTable $table + * @param \Webmasterskaya\Component\OauthServer\Administrator\Table\AccessTokenTable $table + * * @return void * @since version */ protected function prepareTable($table) { - if ($table->expiry instanceof \DateTime || $table->expiry instanceof \DateTimeImmutable) { + if ($table->expiry instanceof \DateTime || $table->expiry instanceof \DateTimeImmutable) + { $table->expiry = $table->expiry->format($table->getDbo()->getDateFormat()); } } + /** + * @param $name + * @param $prefix + * @param $options + * + * @return bool|Table|AccessTokenTable + * @throws \Exception + * @since version + */ public function getTable($name = 'AccessToken', $prefix = 'Administrator', $options = []) { return parent::getTable($name, $prefix, $options); } -} \ No newline at end of file +}