From 38a78947a77741d00a5891f45f26e2fc8e09e2ef Mon Sep 17 00:00:00 2001 From: ferishili Date: Tue, 7 Nov 2023 10:41:48 +0100 Subject: [PATCH] apply snake_case: according to change requests --- .../class.xoctPublicationGroupTableGUI.php | 20 ++++---- .../class.xoctPublicationSubUsageTableGUI.php | 46 +++++++++---------- .../class.xoctPublicationUsageTableGUI.php | 38 +++++++-------- .../Config/PublicationUsageDefault.php | 16 +++---- src/Model/Publication/PublicationSelector.php | 44 +++++++++--------- 5 files changed, 82 insertions(+), 82 deletions(-) diff --git a/classes/Conf/PublicationUsage/class.xoctPublicationGroupTableGUI.php b/classes/Conf/PublicationUsage/class.xoctPublicationGroupTableGUI.php index e7126df0b..f78710746 100644 --- a/classes/Conf/PublicationUsage/class.xoctPublicationGroupTableGUI.php +++ b/classes/Conf/PublicationUsage/class.xoctPublicationGroupTableGUI.php @@ -60,14 +60,14 @@ public function __construct(xoctPublicationUsageGUI $a_parent_obj, $a_parent_cmd public function fillRow($a_set) { /** - * @var $PublicationUsageGroup PublicationUsageGroup + * @var $publication_usage_group PublicationUsageGroup */ - $xoctPublicationUsageGroup = PublicationUsageGroup::find($a_set['id']); - $this->tpl->setVariable('NAME', $xoctPublicationUsageGroup->getName()); - $this->tpl->setVariable('DISPLAY_NAME', $xoctPublicationUsageGroup->getDisplayName()); - $this->tpl->setVariable('DESCRIPTION', $xoctPublicationUsageGroup->getDescription()); + $$publication_usage_group = PublicationUsageGroup::find($a_set['id']); + $this->tpl->setVariable('NAME', $$publication_usage_group->getName()); + $this->tpl->setVariable('DISPLAY_NAME', $$publication_usage_group->getDisplayName()); + $this->tpl->setVariable('DESCRIPTION', $$publication_usage_group->getDescription()); - $this->addActionMenu($xoctPublicationUsageGroup); + $this->addActionMenu($$publication_usage_group); } @@ -82,18 +82,18 @@ protected function initColumns() /** - * @param PublicationUsageGroup $xoctPublicationUsageGroup + * @param PublicationUsageGroup $publication_usage_group * * @throws DICException */ - protected function addActionMenu(PublicationUsageGroup $xoctPublicationUsageGroup) + protected function addActionMenu(PublicationUsageGroup $publication_usage_group) { $current_selection_list = new ilAdvancedSelectionListGUI(); $current_selection_list->setListTitle($this->plugin->txt('common_actions')); - $current_selection_list->setId(self::TBL_ID . '_actions_' . $xoctPublicationUsageGroup->getId()); + $current_selection_list->setId(self::TBL_ID . '_actions_' . $publication_usage_group->getId()); $current_selection_list->setUseImages(false); - $this->ctrl->setParameter($this->parent_obj, 'id', $xoctPublicationUsageGroup->getId()); + $this->ctrl->setParameter($this->parent_obj, 'id', $publication_usage_group->getId()); $current_selection_list->addItem( $this->parent_obj->txt(xoctPublicationUsageGUI::CMD_EDIT), xoctPublicationUsageGUI::CMD_EDIT_GROUP, diff --git a/classes/Conf/PublicationUsage/class.xoctPublicationSubUsageTableGUI.php b/classes/Conf/PublicationUsage/class.xoctPublicationSubUsageTableGUI.php index e42901e96..0a0e2faca 100644 --- a/classes/Conf/PublicationUsage/class.xoctPublicationSubUsageTableGUI.php +++ b/classes/Conf/PublicationUsage/class.xoctPublicationSubUsageTableGUI.php @@ -61,42 +61,42 @@ public function __construct(xoctPublicationUsageGUI $a_parent_obj, $a_parent_cmd public function fillRow($a_set) { /** - * @var $PublicationSubUsage PublicationSubUsage + * @var $publication_sub_usage PublicationSubUsage */ - $PublicationSubUsage = PublicationSubUsage::find($a_set['id']); - $this->tpl->setVariable('PARENT_USAGE_ID', $PublicationSubUsage->getParentUsageId()); - $this->tpl->setVariable('TITLE', $PublicationSubUsage->getTitle()); - $this->tpl->setVariable('DISPLAY_NAME', $PublicationSubUsage->getDisplayName()); - $this->tpl->setVariable('DESCRIPTION', $PublicationSubUsage->getDescription()); - $this->tpl->setVariable('CHANNEL', $PublicationSubUsage->getChannel()); - $this->tpl->setVariable('MD_TYPE', $this->parent_obj->txt('md_type_' . $PublicationSubUsage->getMdType())); - if ($PublicationSubUsage->getMdType() === PublicationUsage::MD_TYPE_PUBLICATION_ITSELF) { + $publication_sub_usage = PublicationSubUsage::find($a_set['id']); + $this->tpl->setVariable('PARENT_USAGE_ID', $publication_sub_usage->getParentUsageId()); + $this->tpl->setVariable('TITLE', $publication_sub_usage->getTitle()); + $this->tpl->setVariable('DISPLAY_NAME', $publication_sub_usage->getDisplayName()); + $this->tpl->setVariable('DESCRIPTION', $publication_sub_usage->getDescription()); + $this->tpl->setVariable('CHANNEL', $publication_sub_usage->getChannel()); + $this->tpl->setVariable('MD_TYPE', $this->parent_obj->txt('md_type_' . $publication_sub_usage->getMdType())); + if ($publication_sub_usage->getMdType() === PublicationUsage::MD_TYPE_PUBLICATION_ITSELF) { $this->tpl->setVariable('FLAVOR', ' '); $this->tpl->setVariable('TAG', ' '); - } elseif ($PublicationSubUsage->getSearchKey() == xoctPublicationUsageFormGUI::F_FLAVOR) { - $this->tpl->setVariable('FLAVOR', $PublicationSubUsage->getFlavor()); + } elseif ($publication_sub_usage->getSearchKey() == xoctPublicationUsageFormGUI::F_FLAVOR) { + $this->tpl->setVariable('FLAVOR', $publication_sub_usage->getFlavor()); $this->tpl->setVariable('TAG', ' '); } else { - $this->tpl->setVariable('TAG', $PublicationSubUsage->getTag()); + $this->tpl->setVariable('TAG', $publication_sub_usage->getTag()); $this->tpl->setVariable('FLAVOR', ' '); } $group_name = ''; - if (!is_null($PublicationSubUsage->getGroupId())) { - $PublicationUsageGroup = PublicationUsageGroup::find($PublicationSubUsage->getGroupId()); - $group_name = $PublicationUsageGroup ? $PublicationUsageGroup->getName() : $group_name; + if (!is_null($publication_sub_usage->getGroupId())) { + $publication_usage_group = PublicationUsageGroup::find($publication_sub_usage->getGroupId()); + $group_name = $publication_usage_group ? $publication_usage_group->getName() : $group_name; } $this->tpl->setVariable('GROUP_NAME', $group_name); $extras = []; - if ($PublicationSubUsage->getParentUsageId() == PublicationUsage::USAGE_DOWNLOAD || - $PublicationSubUsage->getParentUsageId() == PublicationUsage::USAGE_DOWNLOAD_FALLBACK) { - if ($PublicationSubUsage->isExternalDownloadSource()) { + if ($publication_sub_usage->getParentUsageId() == PublicationUsage::USAGE_DOWNLOAD || + $publication_sub_usage->getParentUsageId() == PublicationUsage::USAGE_DOWNLOAD_FALLBACK) { + if ($publication_sub_usage->isExternalDownloadSource()) { $extras[] = $this->parent_obj->txt('ext_dl_source'); } } $this->tpl->setVariable('EXTRA_CONFIG', implode('
', $extras)); - $this->addActionMenu($PublicationSubUsage); + $this->addActionMenu($publication_sub_usage); } @@ -118,18 +118,18 @@ protected function initColumns() /** - * @param PublicationSubUsage $PublicationSubUsage + * @param PublicationSubUsage $publication_sub_usage * * @throws DICException */ - protected function addActionMenu(PublicationSubUsage $PublicationSubUsage) + protected function addActionMenu(PublicationSubUsage $publication_sub_usage) { $current_selection_list = new ilAdvancedSelectionListGUI(); $current_selection_list->setListTitle($this->plugin->txt('common_actions')); - $current_selection_list->setId(self::TBL_ID . '_actions_' . $PublicationSubUsage->getId()); + $current_selection_list->setId(self::TBL_ID . '_actions_' . $publication_sub_usage->getId()); $current_selection_list->setUseImages(false); - $this->ctrl->setParameter($this->parent_obj, 'id', $PublicationSubUsage->getId()); + $this->ctrl->setParameter($this->parent_obj, 'id', $publication_sub_usage->getId()); $current_selection_list->addItem( $this->parent_obj->txt(xoctPublicationUsageGUI::CMD_EDIT), xoctPublicationUsageGUI::CMD_EDIT_SUB, diff --git a/classes/Conf/PublicationUsage/class.xoctPublicationUsageTableGUI.php b/classes/Conf/PublicationUsage/class.xoctPublicationUsageTableGUI.php index ff766c1f0..7810ab729 100755 --- a/classes/Conf/PublicationUsage/class.xoctPublicationUsageTableGUI.php +++ b/classes/Conf/PublicationUsage/class.xoctPublicationUsageTableGUI.php @@ -68,42 +68,42 @@ public function __construct(xoctPublicationUsageGUI $a_parent_obj, $a_parent_cmd protected function fillRow($a_set) { /** - * @var $PublicationUsage PublicationUsage + * @var $publication_usage PublicationUsage */ - $PublicationUsage = $this->repository->getUsage($a_set['usage_id']); - $this->tpl->setVariable('USAGE_ID', $PublicationUsage->getUsageId()); - $this->tpl->setVariable('TITLE', $PublicationUsage->getTitle()); - $this->tpl->setVariable('DISPLAY_NAME', $PublicationUsage->getDisplayName()); - $this->tpl->setVariable('DESCRIPTION', $PublicationUsage->getDescription()); - $this->tpl->setVariable('CHANNEL', $PublicationUsage->getChannel()); - $this->tpl->setVariable('MD_TYPE', $this->parent_obj->txt('md_type_' . $PublicationUsage->getMdType())); - if ($PublicationUsage->getMdType() === PublicationUsage::MD_TYPE_PUBLICATION_ITSELF) { + $publication_usage = $this->repository->getUsage($a_set['usage_id']); + $this->tpl->setVariable('USAGE_ID', $publication_usage->getUsageId()); + $this->tpl->setVariable('TITLE', $publication_usage->getTitle()); + $this->tpl->setVariable('DISPLAY_NAME', $publication_usage->getDisplayName()); + $this->tpl->setVariable('DESCRIPTION', $publication_usage->getDescription()); + $this->tpl->setVariable('CHANNEL', $publication_usage->getChannel()); + $this->tpl->setVariable('MD_TYPE', $this->parent_obj->txt('md_type_' . $publication_usage->getMdType())); + if ($publication_usage->getMdType() === PublicationUsage::MD_TYPE_PUBLICATION_ITSELF) { $this->tpl->setVariable('FLAVOR', ' '); $this->tpl->setVariable('TAG', ' '); - } elseif ($PublicationUsage->getSearchKey() == xoctPublicationUsageFormGUI::F_FLAVOR) { - $this->tpl->setVariable('FLAVOR', $PublicationUsage->getFlavor()); + } elseif ($publication_usage->getSearchKey() == xoctPublicationUsageFormGUI::F_FLAVOR) { + $this->tpl->setVariable('FLAVOR', $publication_usage->getFlavor()); $this->tpl->setVariable('TAG', ' '); } else { - $this->tpl->setVariable('TAG', $PublicationUsage->getTag()); + $this->tpl->setVariable('TAG', $publication_usage->getTag()); $this->tpl->setVariable('FLAVOR', ' '); } $group_name = ''; - if (!is_null($PublicationUsage->getGroupId())) { - $PublicationUsageGroup = PublicationUsageGroup::find($PublicationUsage->getGroupId()); - $group_name = $PublicationUsageGroup ? $PublicationUsageGroup->getName() : $group_name; + if (!is_null($publication_usage->getGroupId())) { + $$publication_usage_group = PublicationUsageGroup::find($publication_usage->getGroupId()); + $group_name = $$publication_usage_group ? $$publication_usage_group->getName() : $group_name; } $this->tpl->setVariable('GROUP_NAME', $group_name); $extras = []; - if ($PublicationUsage->getUsageId() == PublicationUsage::USAGE_DOWNLOAD || - $PublicationUsage->getUsageId() == PublicationUsage::USAGE_DOWNLOAD_FALLBACK) { - if ($PublicationUsage->isExternalDownloadSource()) { + if ($publication_usage->getUsageId() == PublicationUsage::USAGE_DOWNLOAD || + $publication_usage->getUsageId() == PublicationUsage::USAGE_DOWNLOAD_FALLBACK) { + if ($publication_usage->isExternalDownloadSource()) { $extras[] = $this->parent_obj->txt('ext_dl_source'); } } $this->tpl->setVariable('EXTRA_CONFIG', implode('
', $extras)); - $this->addActionMenu($PublicationUsage); + $this->addActionMenu($publication_usage); } protected function initColumns() diff --git a/src/Model/Publication/Config/PublicationUsageDefault.php b/src/Model/Publication/Config/PublicationUsageDefault.php index 8ef4dffd5..914c6c59a 100644 --- a/src/Model/Publication/Config/PublicationUsageDefault.php +++ b/src/Model/Publication/Config/PublicationUsageDefault.php @@ -80,13 +80,13 @@ public static function getDefaultUsage(string $usage) if (is_null($defaults)) { return null; } - $PublicationUsage = new PublicationUsage(); - $PublicationUsage->setUsageId($usage); - $PublicationUsage->setChannel($defaults['channel']); - $PublicationUsage->setMdType($defaults['md_type']); - $PublicationUsage->setSearchKey($defaults['search_key']); - $PublicationUsage->setFlavor($defaults['flavor']); - $PublicationUsage->setTag($defaults['tag']); - return $PublicationUsage; + $publication_usage = new PublicationUsage(); + $publication_usage->setUsageId($usage); + $publication_usage->setChannel($defaults['channel']); + $publication_usage->setMdType($defaults['md_type']); + $publication_usage->setSearchKey($defaults['search_key']); + $publication_usage->setFlavor($defaults['flavor']); + $publication_usage->setTag($defaults['tag']); + return $publication_usage; } } diff --git a/src/Model/Publication/PublicationSelector.php b/src/Model/Publication/PublicationSelector.php index 4de223cab..272d711a3 100644 --- a/src/Model/Publication/PublicationSelector.php +++ b/src/Model/Publication/PublicationSelector.php @@ -469,27 +469,27 @@ public function getThumbnailUrl() } /** - * @param $PublicationUsage + * @param $publication_usage * * @return Publication[]|Media[]|Attachment[] * @throws xoctException */ - public function getPublicationMetadataForUsage($PublicationUsage): array + public function getPublicationMetadataForUsage($publication_usage): array { - if (!$PublicationUsage instanceof PublicationUsage) { + if (!$publication_usage instanceof PublicationUsage) { return []; } - $usage_type = property_exists($PublicationUsage, 'is_sub') ? PublicationUsage::USAGE_TYPE_SUB : PublicationUsage::USAGE_TYPE_ORG; - $usage_id = property_exists($PublicationUsage, 'sub_id') ? $PublicationUsage->sub_id : $PublicationUsage->getUsageId(); + $usage_type = property_exists($publication_usage, 'is_sub') ? PublicationUsage::USAGE_TYPE_SUB : PublicationUsage::USAGE_TYPE_ORG; + $usage_id = property_exists($publication_usage, 'sub_id') ? $publication_usage->sub_id : $publication_usage->getUsageId(); /** - * @var $PublicationUsage PublicationUsage + * @var $publication_usage PublicationUsage * @var $attachment Attachment * @var $medium Media */ $media = []; $attachments = []; foreach ($this->getPublications() as $publication) { - if ($publication->getChannel() === $PublicationUsage->getChannel()) { + if ($publication->getChannel() === $publication_usage->getChannel()) { $media += $publication->getMedia(); $attachments += $publication->getAttachments(); } @@ -506,21 +506,21 @@ public function getPublicationMetadataForUsage($PublicationUsage): array return $medium; }, $media); $return = []; - switch ($PublicationUsage->getMdType()) { + switch ($publication_usage->getMdType()) { case PublicationUsage::MD_TYPE_ATTACHMENT: foreach ($attachments as $attachment) { - switch ($PublicationUsage->getSearchKey()) { + switch ($publication_usage->getSearchKey()) { case PublicationUsage::SEARCH_KEY_FLAVOR: - if ($this->checkFlavor($attachment->getFlavor(), $PublicationUsage->getFlavor())) { - $result = $this->checkMediaTypes($attachment, $PublicationUsage); + if ($this->checkFlavor($attachment->getFlavor(), $publication_usage->getFlavor())) { + $result = $this->checkMediaTypes($attachment, $publication_usage); if (!empty($result)) { $return[] = clone $result; } } break; case PublicationUsage::SEARCH_KEY_TAG: - if (in_array($PublicationUsage->getTag(), $attachment->getTags())) { - $result = $this->checkMediaTypes($attachment, $PublicationUsage); + if (in_array($publication_usage->getTag(), $attachment->getTags())) { + $result = $this->checkMediaTypes($attachment, $publication_usage); if (!empty($result)) { $return[] = clone $result; } @@ -531,18 +531,18 @@ public function getPublicationMetadataForUsage($PublicationUsage): array break; case PublicationUsage::MD_TYPE_MEDIA: foreach ($media as $medium) { - switch ($PublicationUsage->getSearchKey()) { + switch ($publication_usage->getSearchKey()) { case PublicationUsage::SEARCH_KEY_FLAVOR: - if ($this->checkFlavor($medium->getFlavor(), $PublicationUsage->getFlavor())) { - $result = $this->checkMediaTypes($medium, $PublicationUsage); + if ($this->checkFlavor($medium->getFlavor(), $publication_usage->getFlavor())) { + $result = $this->checkMediaTypes($medium, $publication_usage); if (!empty($result)) { $return[] = clone $result; } } break; case PublicationUsage::SEARCH_KEY_TAG: - if (in_array($PublicationUsage->getTag(), $medium->getTags())) { - $result = $this->checkMediaTypes($medium, $PublicationUsage); + if (in_array($publication_usage->getTag(), $medium->getTags())) { + $result = $this->checkMediaTypes($medium, $publication_usage); if (!empty($result)) { $return[] = clone $result; } @@ -553,7 +553,7 @@ public function getPublicationMetadataForUsage($PublicationUsage): array break; case PublicationUsage::MD_TYPE_PUBLICATION_ITSELF: foreach ($this->getPublications() as $publication) { - if ($publication->getChannel() == $PublicationUsage->getChannel()) { + if ($publication->getChannel() == $publication_usage->getChannel()) { $publication->usage_type = $usage_type; $publication->usage_id = $usage_id; $return[] = clone $publication; @@ -623,13 +623,13 @@ public function setReference(SerializableClosure $reference): void /** * Returns the publication if the media type matches the usage media type, null otherwise. * @param publicationMetadata $publicationType - * @param PublicationUsage $publicationUsage + * @param PublicationUsage $publication_usage * * @return publicationMetadata|null */ - private function checkMediaTypes(publicationMetadata $publicationType, PublicationUsage $publicationUsage): ?publicationMetadata + private function checkMediaTypes(publicationMetadata $publicationType, PublicationUsage $publication_usage): ?publicationMetadata { - $media_types = $publicationUsage->getArrayMediaTypes(); + $media_types = $publication_usage->getArrayMediaTypes(); if (empty($media_types)) { return $publicationType; }