diff --git a/administrator/components/com_actionlogs/src/Helper/ActionlogsHelper.php b/administrator/components/com_actionlogs/src/Helper/ActionlogsHelper.php index 68cab09bbc17a..e1499ca9b8672 100644 --- a/administrator/components/com_actionlogs/src/Helper/ActionlogsHelper.php +++ b/administrator/components/com_actionlogs/src/Helper/ActionlogsHelper.php @@ -13,7 +13,6 @@ use Joomla\CMS\Date\Date; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Router\Route; use Joomla\Filesystem\Path; use Joomla\String\StringHelper; @@ -232,7 +231,7 @@ public static function getHumanReadableLogMessage($log, $generateLinks = true) * @param string $contentType * @param integer $id * @param string $urlVar - * @param CMSObject $object + * @param \stdClass $object * * @return string Link to the content item * diff --git a/administrator/components/com_guidedtours/src/Model/TourModel.php b/administrator/components/com_guidedtours/src/Model/TourModel.php index 1bc1e6512c6b1..6b96e526ed125 100644 --- a/administrator/components/com_guidedtours/src/Model/TourModel.php +++ b/administrator/components/com_guidedtours/src/Model/TourModel.php @@ -15,7 +15,6 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\Log\Log; use Joomla\CMS\MVC\Model\AdminModel; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\PluginHelper; use Joomla\Component\Guidedtours\Administrator\Helper\GuidedtoursHelper; use Joomla\Database\ParameterType; @@ -221,9 +220,9 @@ public function getItem($pk = null) return false; } - // Convert to the CMSObject before adding other data. + // Convert to an object before adding other data. $properties = $table->getProperties(1); - $item = ArrayHelper::toObject($properties, CMSObject::class); + $item = ArrayHelper::toObject($properties); if (property_exists($item, 'params')) { $registry = new Registry($item->params); diff --git a/administrator/components/com_guidedtours/src/View/Step/HtmlView.php b/administrator/components/com_guidedtours/src/View/Step/HtmlView.php index a25ee5be05f74..9a1a784157980 100644 --- a/administrator/components/com_guidedtours/src/View/Step/HtmlView.php +++ b/administrator/components/com_guidedtours/src/View/Step/HtmlView.php @@ -17,6 +17,7 @@ use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Component\Guidedtours\Administrator\Model\StepModel; +use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -53,7 +54,7 @@ class HtmlView extends BaseHtmlView /** * The actions the user is authorised to perform * - * @var \Joomla\CMS\Object\CMSObject + * @var Registry */ protected $canDo; diff --git a/administrator/components/com_installer/src/Helper/InstallerHelper.php b/administrator/components/com_installer/src/Helper/InstallerHelper.php index f0899df2e4045..2054f5b3e2231 100644 --- a/administrator/components/com_installer/src/Helper/InstallerHelper.php +++ b/administrator/components/com_installer/src/Helper/InstallerHelper.php @@ -13,7 +13,6 @@ use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; use Joomla\Database\DatabaseInterface; use Joomla\Database\ParameterType; @@ -233,19 +232,19 @@ public static function getInstallationXML( /** * Get the download key of an extension going through their installation xml * - * @param CMSObject $extension element of an extension + * @param \stdClass $extension element of an extension * * @return array An array with the prefix, suffix and value of the download key * * @since 4.0.0 */ - public static function getDownloadKey(CMSObject $extension): array + public static function getDownloadKey(\stdClass $extension): array { $installXmlFile = self::getInstallationXML( - $extension->get('element'), - $extension->get('type'), - $extension->get('client_id'), - $extension->get('folder') + $extension->element, + $extension->type, + $extension->client_id, + $extension->folder ); if (!$installXmlFile) { @@ -264,7 +263,7 @@ public static function getDownloadKey(CMSObject $extension): array $prefix = (string) $installXmlFile->dlid['prefix']; $suffix = (string) $installXmlFile->dlid['suffix']; - $value = substr($extension->get('extra_query'), \strlen($prefix)); + $value = substr($extension->extra_query ?? '', \strlen($prefix)); if ($suffix) { $value = substr($value, 0, -\strlen($suffix)); @@ -309,7 +308,7 @@ public static function getExtensionDownloadKey( ]; } - // Try to retrieve the extension information as a CMSObject + // Try to retrieve the extension information $query = $db->getQuery(true) ->select($db->quoteName('extension_id')) ->from($db->quoteName('#__extensions')) @@ -323,7 +322,7 @@ public static function getExtensionDownloadKey( $query->bind(':folder', $folder, ParameterType::STRING); try { - $extension = new CMSObject($db->setQuery($query)->loadAssoc()); + $extension = $db->setQuery($query)->loadObject(); } catch (\Exception $e) { return [ 'supported' => false, @@ -355,15 +354,15 @@ public static function getDownloadKeySupportedSites($onlyEnabled = false): array $extensions = self::getUpdateSitesInformation($onlyEnabled); - $filterClosure = function (CMSObject $extension) { + $filterClosure = function ($extension) { $dlidInfo = self::getDownloadKey($extension); return $dlidInfo['supported']; }; $extensions = array_filter($extensions, $filterClosure); - $mapClosure = function (CMSObject $extension) { - return $extension->get('update_site_id'); + $mapClosure = function ($extension) { + return $extension->update_site_id ?? null; }; return array_map($mapClosure, $extensions); @@ -391,7 +390,7 @@ public static function getDownloadKeyExistsSites(bool $exists = true, $onlyEnabl $extensions = self::getUpdateSitesInformation($onlyEnabled); // Filter the extensions by what supports Download Keys - $filterClosure = function (CMSObject $extension) use ($exists) { + $filterClosure = function ($extension) use ($exists) { $dlidInfo = self::getDownloadKey($extension); if (!$dlidInfo['supported']) { @@ -403,8 +402,8 @@ public static function getDownloadKeyExistsSites(bool $exists = true, $onlyEnabl $extensions = array_filter($extensions, $filterClosure); // Return only the update site IDs - $mapClosure = function (CMSObject $extension) { - return $extension->get('update_site_id'); + $mapClosure = function ($extension) { + return $extension->update_site_id ?? null; }; return array_map($mapClosure, $extensions); @@ -416,7 +415,7 @@ public static function getDownloadKeyExistsSites(bool $exists = true, $onlyEnabl * * @param bool $onlyEnabled Only return enabled update sites * - * @return CMSObject[] List of update site and linked extension information + * @return \stdClass[] List of update site and linked extension information * @since 4.0.0 */ protected static function getUpdateSitesInformation(bool $onlyEnabled): array @@ -473,14 +472,9 @@ protected static function getUpdateSitesInformation(bool $onlyEnabled): array // Try to get all of the update sites, including related extension information try { - $items = []; $db->setQuery($query); - foreach ($db->getIterator() as $item) { - $items[] = new CMSObject($item); - } - - return $items; + return $db->loadObjectList(); } catch (\Exception $e) { return []; } diff --git a/administrator/components/com_installer/src/Model/UpdatesiteModel.php b/administrator/components/com_installer/src/Model/UpdatesiteModel.php index cdb5f0528eaaa..ae1f25afd113f 100644 --- a/administrator/components/com_installer/src/Model/UpdatesiteModel.php +++ b/administrator/components/com_installer/src/Model/UpdatesiteModel.php @@ -12,7 +12,6 @@ use Joomla\CMS\Form\Form; use Joomla\CMS\MVC\Model\AdminModel; -use Joomla\CMS\Object\CMSObject; use Joomla\Component\Installer\Administrator\Helper\InstallerHelper; use Joomla\Database\ParameterType; @@ -87,7 +86,7 @@ public function getItem($pk = null) $item = parent::getItem($pk); $db = $this->getDatabase(); - $updateSiteId = (int) $item->get('update_site_id'); + $updateSiteId = (int) $item->update_site_id ?? 0; $query = $db->getQuery(true) ->select( $db->quoteName( @@ -116,13 +115,13 @@ public function getItem($pk = null) ->bind(':updatesiteid', $updateSiteId, ParameterType::INTEGER); $db->setQuery($query); - $extension = new CMSObject($db->loadAssoc()); + $extension = $db->loadObject(); $downloadKey = InstallerHelper::getDownloadKey($extension); - $item->set('extra_query', $downloadKey['value'] ?? ''); - $item->set('downloadIdPrefix', $downloadKey['prefix'] ?? ''); - $item->set('downloadIdSuffix', $downloadKey['suffix'] ?? ''); + $item->extra_query = $downloadKey['value'] ?? ''; + $item->downloadIdPrefix = $downloadKey['prefix'] ?? ''; + $item->downloadIdSuffix = $downloadKey['suffix'] ?? ''; return $item; } diff --git a/administrator/components/com_installer/src/Model/UpdatesitesModel.php b/administrator/components/com_installer/src/Model/UpdatesitesModel.php index b8b48d027f701..b2a581fd31f3f 100644 --- a/administrator/components/com_installer/src/Model/UpdatesitesModel.php +++ b/administrator/components/com_installer/src/Model/UpdatesitesModel.php @@ -14,7 +14,6 @@ use Joomla\CMS\Installer\Installer; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Router\Route; use Joomla\CMS\Table\UpdateSite as UpdateSiteTable; @@ -444,8 +443,7 @@ public function getItems() array_walk( $items, static function ($item) { - $data = new CMSObject($item); - $item->downloadKey = InstallerHelper::getDownloadKey($data); + $item->downloadKey = InstallerHelper::getDownloadKey($item); } ); diff --git a/administrator/components/com_installer/src/View/Update/HtmlView.php b/administrator/components/com_installer/src/View/Update/HtmlView.php index 819a80eeb4d57..b59c12358bb18 100644 --- a/administrator/components/com_installer/src/View/Update/HtmlView.php +++ b/administrator/components/com_installer/src/View/Update/HtmlView.php @@ -13,7 +13,6 @@ use Joomla\CMS\Application\CMSApplication; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; use Joomla\Component\Installer\Administrator\Helper\InstallerHelper as CmsInstallerHelper; use Joomla\Component\Installer\Administrator\Model\UpdateModel; use Joomla\Component\Installer\Administrator\View\Installer\HtmlView as InstallerViewDefault; @@ -32,7 +31,7 @@ class HtmlView extends InstallerViewDefault /** * List of update items. * - * @var array + * @var \stdClass[] */ protected $items; @@ -105,7 +104,7 @@ public function display($tpl = null) } $mappingCallback = function ($item) { - $dlkeyInfo = CmsInstallerHelper::getDownloadKey(new CMSObject($item)); + $dlkeyInfo = CmsInstallerHelper::getDownloadKey($item); $item->isMissingDownloadKey = $dlkeyInfo['supported'] && !$dlkeyInfo['valid']; if ($item->isMissingDownloadKey) { diff --git a/administrator/components/com_languages/src/Model/LanguageModel.php b/administrator/components/com_languages/src/Model/LanguageModel.php index a479781207a2e..230e629ca078c 100644 --- a/administrator/components/com_languages/src/Model/LanguageModel.php +++ b/administrator/components/com_languages/src/Model/LanguageModel.php @@ -16,7 +16,6 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\AdminModel; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Table\Language; use Joomla\CMS\Table\Table; @@ -128,7 +127,7 @@ public function getItem($langId = null) } $properties = $table->getProperties(1); - $value = ArrayHelper::toObject($properties, CMSObject::class); + $value = ArrayHelper::toObject($properties); return $value; } diff --git a/administrator/components/com_mails/src/Model/TemplateModel.php b/administrator/components/com_mails/src/Model/TemplateModel.php index c6849b31a4de3..e1e9d212302db 100644 --- a/administrator/components/com_mails/src/Model/TemplateModel.php +++ b/administrator/components/com_mails/src/Model/TemplateModel.php @@ -16,7 +16,6 @@ use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Model\AdminModel; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Table\Table; use Joomla\Filesystem\Path; use Joomla\Registry\Registry; @@ -176,9 +175,9 @@ public function getItem($pk = null) } } - // Convert to the CMSObject before adding other data. + // Convert to an object before adding other data. $properties = $table->getProperties(1); - $item = ArrayHelper::toObject($properties, CMSObject::class); + $item = ArrayHelper::toObject($properties); if (property_exists($item, 'params')) { $registry = new Registry($item->params); @@ -222,9 +221,9 @@ public function getMaster($pk = null) } } - // Convert to the CMSObject before adding other data. + // Convert to an object before adding other data. $properties = $table->getProperties(1); - $item = ArrayHelper::toObject($properties, CMSObject::class); + $item = ArrayHelper::toObject($properties); if (property_exists($item, 'params')) { $registry = new Registry($item->params); diff --git a/administrator/components/com_mails/src/View/Template/HtmlView.php b/administrator/components/com_mails/src/View/Template/HtmlView.php index 6c76a01e52aa3..f0f39fd2717f6 100644 --- a/administrator/components/com_mails/src/View/Template/HtmlView.php +++ b/administrator/components/com_mails/src/View/Template/HtmlView.php @@ -14,8 +14,6 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\GenericDataException; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; -use Joomla\CMS\Object\CMSObject; -use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Component\Mails\Administrator\Helper\MailsHelper; use Joomla\Component\Mails\Administrator\Model\TemplateModel; @@ -62,7 +60,7 @@ class HtmlView extends BaseHtmlView /** * Master data for the mail template * - * @var CMSObject + * @var \stdClass */ protected $master; diff --git a/administrator/components/com_media/helpers/media.php b/administrator/components/com_media/helpers/media.php index 6e9aa05cd81fd..57f5788769644 100644 --- a/administrator/components/com_media/helpers/media.php +++ b/administrator/components/com_media/helpers/media.php @@ -10,8 +10,6 @@ * @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace */ -use Joomla\CMS\Object\CMSObject; - // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects @@ -26,26 +24,24 @@ abstract class MediaHelper /** * Generates the URL to the object in the action logs component * - * @param string $contentType The content type - * @param integer $id The integer id - * @param CMSObject $mediaObject The media object being uploaded + * @param string $contentType The content type + * @param integer $id The integer id + * @param \stdClass $mediaObject The media object being uploaded * * @return string The link for the action log * * @since 3.9.27 */ - public static function getContentTypeLink($contentType, $id, CMSObject $mediaObject) + public static function getContentTypeLink($contentType, $id, \stdClass $mediaObject) { if ($contentType === 'com_media.file') { return ''; } - $link = 'index.php?option=com_media'; - $adapter = $mediaObject->get('adapter'); - $uploadedPath = $mediaObject->get('path'); + $link = 'index.php?option=com_media'; - if (!empty($adapter) && !empty($uploadedPath)) { - $link .= '&path=' . $adapter . ':' . $uploadedPath; + if (!empty($mediaObject->adapter) && !empty($mediaObject->path)) { + $link .= '&path=' . $mediaObject->adapter . ':' . $mediaObject->path; } return $link; diff --git a/administrator/components/com_menus/src/Model/MenuModel.php b/administrator/components/com_menus/src/Model/MenuModel.php index 9f58f2cc60e41..ddf02e9571032 100644 --- a/administrator/components/com_menus/src/Model/MenuModel.php +++ b/administrator/components/com_menus/src/Model/MenuModel.php @@ -14,7 +14,6 @@ use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; use Joomla\CMS\MVC\Model\AdminModel; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Table\Table; use Joomla\Registry\Registry; @@ -121,7 +120,7 @@ protected function populateState() * * @param integer $itemId The id of the menu item to get. * - * @return mixed Menu item data object on success, false on failure. + * @return \stdClass|false Menu item data object on success, false on failure. * * @since 1.6 */ @@ -143,7 +142,7 @@ public function getItem($itemId = null) } $properties = $table->getProperties(1); - $value = ArrayHelper::toObject($properties, CMSObject::class); + $value = ArrayHelper::toObject($properties); return $value; } diff --git a/administrator/components/com_menus/src/Model/MenutypesModel.php b/administrator/components/com_menus/src/Model/MenutypesModel.php index f38f88e66743c..072fbc6139f28 100644 --- a/administrator/components/com_menus/src/Model/MenutypesModel.php +++ b/administrator/components/com_menus/src/Model/MenutypesModel.php @@ -14,7 +14,6 @@ use Joomla\CMS\Event\Menu\AfterGetMenuTypeOptionsEvent; use Joomla\CMS\Factory; use Joomla\CMS\MVC\Model\BaseDatabaseModel; -use Joomla\CMS\Object\CMSObject; use Joomla\Component\Menus\Administrator\Helper\MenusHelper; use Joomla\Filesystem\Folder; @@ -137,7 +136,7 @@ public function getTypeOptions() * Method to create the reverse lookup for link-to-name. * (can be used from onAfterGetMenuTypeOptions handlers) * - * @param CMSObject $option Object with request array or string and title public variables + * @param \stdClass $option Object with request array or string and title public variables * * @return void * @@ -184,7 +183,7 @@ protected function getTypeOptionsByComponent($component) * @param string $file File path * @param string $component Component option as in URL * - * @return array|boolean + * @return \stdClass|boolean * * @since 1.6 */ @@ -207,7 +206,7 @@ protected function getTypeOptionsFromXml($file, $component) // If we have no options to parse, just add the base component to the list of options. if (!empty($menu['options']) && $menu['options'] == 'none') { // Create the menu option for the component. - $o = new CMSObject(); + $o = new \stdClass(); $o->title = (string) $menu['name']; $o->description = (string) $menu['msg']; $o->request = ['option' => $component]; @@ -233,7 +232,7 @@ protected function getTypeOptionsFromXml($file, $component) foreach ($children as $child) { if ($child->getName() == 'option') { // Create the menu option for the component. - $o = new CMSObject(); + $o = new \stdClass(); $o->title = (string) $child['name']; $o->description = (string) $child['msg']; $o->request = ['option' => $component, (string) $optionsNode['var'] => (string) $child['value']]; @@ -241,7 +240,7 @@ protected function getTypeOptionsFromXml($file, $component) $options[] = $o; } elseif ($child->getName() == 'default') { // Create the menu option for the component. - $o = new CMSObject(); + $o = new \stdClass(); $o->title = (string) $child['name']; $o->description = (string) $child['msg']; $o->request = ['option' => $component]; @@ -258,7 +257,7 @@ protected function getTypeOptionsFromXml($file, $component) * * @param string $component Component option like in URLs * - * @return array|boolean + * @return \stdClass[]|boolean * * @since 1.6 */ @@ -307,7 +306,7 @@ protected function getTypeOptionsFromMvc($component) foreach ($children as $child) { if ($child->getName() == 'option') { // Create the menu option for the component. - $o = new CMSObject(); + $o = new \stdClass(); $o->title = (string) $child['name']; $o->description = (string) $child['msg']; $o->request = ['option' => $component, 'view' => $view, (string) $optionsNode['var'] => (string) $child['value']]; @@ -315,7 +314,7 @@ protected function getTypeOptionsFromMvc($component) $options[] = $o; } elseif ($child->getName() == 'default') { // Create the menu option for the component. - $o = new CMSObject(); + $o = new \stdClass(); $o->title = (string) $child['name']; $o->description = (string) $child['msg']; $o->request = ['option' => $component, 'view' => $view]; @@ -345,7 +344,7 @@ protected function getTypeOptionsFromMvc($component) * * @param string $component Component option like in URLs * - * @return array|boolean + * @return \stdClass[]|boolean * * @since 3.7.0 */ @@ -419,7 +418,7 @@ protected function getTypeOptionsFromManifest($component) return \strlen($value); }); - $options[] = new CMSObject($o); + $options[] = $o; // Do not repeat the default view link (index.php?option=com_abc). if (\count($o->request) == 1) { @@ -428,7 +427,7 @@ protected function getTypeOptionsFromManifest($component) } if ($ro) { - $options[] = new CMSObject($ro); + $options[] = $ro; } return $options; @@ -440,7 +439,7 @@ protected function getTypeOptionsFromManifest($component) * @param string $component Component option as in URLs * @param string $view Name of the view * - * @return array + * @return \stdClass[] * * @since 1.6 */ @@ -516,7 +515,7 @@ protected function getTypeOptionsFromLayouts($component, $view) $layout = basename($layout, '.xml'); // Create the menu option for the layout. - $o = new CMSObject(); + $o = new \stdClass(); $o->title = ucfirst($layout); $o->description = ''; $o->request = ['option' => $component, 'view' => $view]; diff --git a/administrator/components/com_menus/src/View/Menutypes/HtmlView.php b/administrator/components/com_menus/src/View/Menutypes/HtmlView.php index 7061caabc73b6..dae25d49a82d9 100644 --- a/administrator/components/com_menus/src/View/Menutypes/HtmlView.php +++ b/administrator/components/com_menus/src/View/Menutypes/HtmlView.php @@ -13,7 +13,6 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Component\Menus\Administrator\Model\MenutypesModel; @@ -39,7 +38,7 @@ class HtmlView extends BaseHtmlView /** * Array of menu types * - * @var CMSObject[] + * @var \stdClass[] * * @since 3.7.0 */ @@ -140,28 +139,28 @@ protected function addCustomTypes(&$types) // Adding System Links $list = []; - $o = new CMSObject(); + $o = new \stdClass(); $o->title = 'COM_MENUS_TYPE_EXTERNAL_URL'; $o->type = 'url'; $o->description = 'COM_MENUS_TYPE_EXTERNAL_URL_DESC'; $o->request = null; $list[] = $o; - $o = new CMSObject(); + $o = new \stdClass(); $o->title = 'COM_MENUS_TYPE_ALIAS'; $o->type = 'alias'; $o->description = 'COM_MENUS_TYPE_ALIAS_DESC'; $o->request = null; $list[] = $o; - $o = new CMSObject(); + $o = new \stdClass(); $o->title = 'COM_MENUS_TYPE_SEPARATOR'; $o->type = 'separator'; $o->description = 'COM_MENUS_TYPE_SEPARATOR_DESC'; $o->request = null; $list[] = $o; - $o = new CMSObject(); + $o = new \stdClass(); $o->title = 'COM_MENUS_TYPE_HEADING'; $o->type = 'heading'; $o->description = 'COM_MENUS_TYPE_HEADING_DESC'; @@ -169,7 +168,7 @@ protected function addCustomTypes(&$types) $list[] = $o; if ($this->state->get('client_id') == 1) { - $o = new CMSObject(); + $o = new \stdClass(); $o->title = 'COM_MENUS_TYPE_CONTAINER'; $o->type = 'container'; $o->description = 'COM_MENUS_TYPE_CONTAINER_DESC'; diff --git a/administrator/components/com_messages/src/Model/ConfigModel.php b/administrator/components/com_messages/src/Model/ConfigModel.php index 4153c5fe9993f..bb4289891d0ab 100644 --- a/administrator/components/com_messages/src/Model/ConfigModel.php +++ b/administrator/components/com_messages/src/Model/ConfigModel.php @@ -12,8 +12,8 @@ use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\FormModel; -use Joomla\CMS\Object\CMSObject; use Joomla\Database\ParameterType; +use Joomla\Registry\Registry; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -53,13 +53,13 @@ protected function populateState() /** * Method to get a single record. * - * @return mixed Object on success, false on failure. + * @return \stdClass|false Object on success, false on failure. * * @since 1.6 */ public function getItem() { - $item = new CMSObject(); + $item = new Registry(); $userid = (int) $this->getState('user.id'); $db = $this->getDatabase(); diff --git a/administrator/components/com_modules/src/Model/ModuleModel.php b/administrator/components/com_modules/src/Model/ModuleModel.php index f3e0a179f3fa3..972156ac7ba44 100644 --- a/administrator/components/com_modules/src/Model/ModuleModel.php +++ b/administrator/components/com_modules/src/Model/ModuleModel.php @@ -18,7 +18,6 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\AdminModel; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Router\Route; use Joomla\CMS\Table\Table; @@ -626,7 +625,7 @@ protected function loadFormData() * * @param integer $pk The id of the primary key. * - * @return mixed Object on success, false on failure. + * @return \stdClass|false Object on success, false on failure. * * @since 1.6 */ @@ -684,9 +683,9 @@ public function getItem($pk = null) } } - // Convert to the \Joomla\CMS\Object\CMSObject before adding other data. + // Convert to an object before adding other data. $properties = $table->getProperties(1); - $this->_cache[$pk] = ArrayHelper::toObject($properties, CMSObject::class); + $this->_cache[$pk] = ArrayHelper::toObject($properties); // Convert the params field to an array. $registry = new Registry($table->params); diff --git a/administrator/components/com_plugins/src/Helper/PluginsHelper.php b/administrator/components/com_plugins/src/Helper/PluginsHelper.php index a32bea364ed84..ed6195de211f9 100644 --- a/administrator/components/com_plugins/src/Helper/PluginsHelper.php +++ b/administrator/components/com_plugins/src/Helper/PluginsHelper.php @@ -13,7 +13,6 @@ use Joomla\CMS\Factory; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Installer\Installer; -use Joomla\CMS\Object\CMSObject; use Joomla\Filesystem\Path; // phpcs:disable PSR1.Files.SideEffects @@ -99,11 +98,11 @@ public static function elementOptions() * @param string $templateBaseDir Base path to the template directory. * @param string $templateDir Template directory. * - * @return CMSObject|bool + * @return \stdClass|bool */ public function parseXMLTemplateFile($templateBaseDir, $templateDir) { - $data = new CMSObject(); + $data = new \stdClass(); // Check of the xml file exists. $filePath = Path::clean($templateBaseDir . '/templates/' . $templateDir . '/templateDetails.xml'); diff --git a/administrator/components/com_plugins/src/Model/PluginModel.php b/administrator/components/com_plugins/src/Model/PluginModel.php index a21be546460dd..e7d528f7eb8cb 100644 --- a/administrator/components/com_plugins/src/Model/PluginModel.php +++ b/administrator/components/com_plugins/src/Model/PluginModel.php @@ -15,7 +15,6 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\AdminModel; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Router\Route; use Joomla\CMS\Table\Table; use Joomla\Filesystem\Path; @@ -177,9 +176,9 @@ public function getItem($pk = null) return false; } - // Convert to the \Joomla\CMS\Object\CMSObject before adding other data. + // Convert to an object before adding other data. $properties = $table->getProperties(1); - $this->_cache[$cacheId] = ArrayHelper::toObject($properties, CMSObject::class); + $this->_cache[$cacheId] = ArrayHelper::toObject($properties); // Convert the params field to an array. $registry = new Registry($table->params); diff --git a/administrator/components/com_scheduler/src/Model/TaskModel.php b/administrator/components/com_scheduler/src/Model/TaskModel.php index 107a52f79be2a..b46d7f0f2880d 100644 --- a/administrator/components/com_scheduler/src/Model/TaskModel.php +++ b/administrator/components/com_scheduler/src/Model/TaskModel.php @@ -20,7 +20,6 @@ use Joomla\CMS\Log\Log; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\AdminModel; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Table\Table; use Joomla\Component\Scheduler\Administrator\Helper\ExecRuleHelper; @@ -274,7 +273,6 @@ protected function loadFormData() // If the data from UserState is empty, we fetch it with getItem() if (empty($data)) { - /** @var CMSObject $data */ $data = $this->getItem(); // @todo : further data processing goes here diff --git a/administrator/components/com_scheduler/src/Model/TasksModel.php b/administrator/components/com_scheduler/src/Model/TasksModel.php index a4b4d1755705c..2f4068fbbafa5 100644 --- a/administrator/components/com_scheduler/src/Model/TasksModel.php +++ b/administrator/components/com_scheduler/src/Model/TasksModel.php @@ -16,7 +16,6 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\ListModel; -use Joomla\CMS\Object\CMSObject; use Joomla\Component\Scheduler\Administrator\Helper\SchedulerHelper; use Joomla\Component\Scheduler\Administrator\Task\TaskOption; use Joomla\Database\ParameterType; @@ -372,25 +371,7 @@ protected function _getList($query, $limitstart = 0, $limit = 0): array // Set limit parameters and get object list $query->setLimit($limit, $limitstart); $this->getDatabase()->setQuery($query); - - // Return optionally an extended class. - // @todo: Use something other than CMSObject.. - if ($this->getState('list.customClass')) { - $responseList = array_map( - static function (array $arr) { - $o = new CMSObject(); - - foreach ($arr as $k => $v) { - $o->{$k} = $v; - } - - return $o; - }, - $this->getDatabase()->loadAssocList() ?: [] - ); - } else { - $responseList = $this->getDatabase()->loadObjectList(); - } + $responseList = $this->getDatabase()->loadObjectList(); // Attach TaskOptions objects and a safe type title $this->attachTaskOptions($responseList); diff --git a/administrator/components/com_templates/src/Helper/TemplatesHelper.php b/administrator/components/com_templates/src/Helper/TemplatesHelper.php index 615354706b65b..98cabd56bf79a 100644 --- a/administrator/components/com_templates/src/Helper/TemplatesHelper.php +++ b/administrator/components/com_templates/src/Helper/TemplatesHelper.php @@ -14,7 +14,6 @@ use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Installer\Installer; use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; use Joomla\Database\ParameterType; use Joomla\Filesystem\Path; @@ -82,11 +81,11 @@ public static function getTemplateOptions($clientId = '*') * @param string $templateBaseDir * @param string $templateDir * - * @return boolean|CMSObject + * @return \stdClass|false */ public static function parseXMLTemplateFile($templateBaseDir, $templateDir) { - $data = new CMSObject(); + $data = new \stdClass(); // Check of the xml file exists $filePath = Path::clean($templateBaseDir . '/templates/' . $templateDir . '/templateDetails.xml'); diff --git a/administrator/components/com_templates/src/Model/StyleModel.php b/administrator/components/com_templates/src/Model/StyleModel.php index 82a5ee954f5c3..894436f6b84a2 100644 --- a/administrator/components/com_templates/src/Model/StyleModel.php +++ b/administrator/components/com_templates/src/Model/StyleModel.php @@ -18,7 +18,6 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\AdminModel; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Table\Extension; use Joomla\Database\ParameterType; @@ -327,7 +326,7 @@ protected function loadFormData() * * @param integer $pk The id of the primary key. * - * @return mixed Object on success, false on failure. + * @return \stdClass|false Object on success, false on failure. */ public function getItem($pk = null) { @@ -347,9 +346,9 @@ public function getItem($pk = null) return false; } - // Convert to the \Joomla\CMS\Object\CMSObject before adding other data. + // Convert to an object before adding other data. $properties = $table->getProperties(1); - $this->_cache[$pk] = ArrayHelper::toObject($properties, CMSObject::class); + $this->_cache[$pk] = ArrayHelper::toObject($properties); // Convert the params field to an array. $registry = new Registry($table->params); diff --git a/administrator/components/com_users/src/Model/GroupModel.php b/administrator/components/com_users/src/Model/GroupModel.php index bcb16170e0977..0a29402b9e4e8 100644 --- a/administrator/components/com_users/src/Model/GroupModel.php +++ b/administrator/components/com_users/src/Model/GroupModel.php @@ -18,7 +18,6 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\AdminModel; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Table\Table; use Joomla\String\StringHelper; @@ -136,7 +135,7 @@ protected function loadFormData() */ protected function preprocessForm(Form $form, $data, $group = '') { - $obj = \is_array($data) ? ArrayHelper::toObject($data, CMSObject::class) : $data; + $obj = \is_array($data) ? ArrayHelper::toObject($data) : $data; if (isset($obj->parent_id) && $obj->parent_id == 0 && $obj->id > 0) { $form->setFieldAttribute('parent_id', 'type', 'hidden'); diff --git a/administrator/components/com_workflow/src/Model/TransitionModel.php b/administrator/components/com_workflow/src/Model/TransitionModel.php index a1db4c04d00ec..4c9cc567f45e4 100644 --- a/administrator/components/com_workflow/src/Model/TransitionModel.php +++ b/administrator/components/com_workflow/src/Model/TransitionModel.php @@ -105,7 +105,7 @@ protected function canEditState($record) * * @param integer $pk The id of the primary key. * - * @return \Joomla\CMS\Object\CMSObject|boolean Object on success, false on failure. + * @return \stdClass|boolean Object on success, false on failure. * * @since 4.0.0 */ diff --git a/components/com_contact/src/Model/FormModel.php b/components/com_contact/src/Model/FormModel.php index 446dea89a5c34..3b63c491c181b 100644 --- a/components/com_contact/src/Model/FormModel.php +++ b/components/com_contact/src/Model/FormModel.php @@ -81,7 +81,7 @@ public function getForm($data = [], $loadData = true) * * @param integer $itemId The id of the contact. * - * @return mixed Contact item data object on success, false on failure. + * @return \stdClass|false Contact item data object on success, false on failure. * * @throws \Exception * @@ -106,7 +106,7 @@ public function getItem($itemId = null) } $properties = $table->getProperties(); - $value = ArrayHelper::toObject($properties, \Joomla\CMS\Object\CMSObject::class); + $value = ArrayHelper::toObject($properties); // Convert field to Registry. $value->params = new Registry($value->params); diff --git a/components/com_content/src/Model/FormModel.php b/components/com_content/src/Model/FormModel.php index 4119f8d610e39..bd916c0946953 100644 --- a/components/com_content/src/Model/FormModel.php +++ b/components/com_content/src/Model/FormModel.php @@ -15,7 +15,6 @@ use Joomla\CMS\Helper\TagsHelper; use Joomla\CMS\Language\Associations; use Joomla\CMS\Language\Multilanguage; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Table\Table; use Joomla\Database\ParameterType; use Joomla\Registry\Registry; @@ -100,7 +99,7 @@ public function getItem($itemId = null) } $properties = $table->getProperties(1); - $value = ArrayHelper::toObject($properties, CMSObject::class); + $value = ArrayHelper::toObject($properties); // Convert attrib field to Registry. $value->params = new Registry($value->attribs); diff --git a/components/com_tags/src/Model/TagModel.php b/components/com_tags/src/Model/TagModel.php index 37d501ebc086e..5d288f2963dfb 100644 --- a/components/com_tags/src/Model/TagModel.php +++ b/components/com_tags/src/Model/TagModel.php @@ -16,7 +16,6 @@ use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\ListModel; -use Joomla\CMS\Object\CMSObject; use Joomla\Component\Tags\Site\Helper\RouteHelper; use Joomla\Database\QueryInterface; use Joomla\Utilities\ArrayHelper; @@ -261,7 +260,7 @@ protected function populateState($ordering = 'c.core_title', $direction = 'ASC') * * @param integer $pk An optional ID * - * @return array + * @return \stdClass|false * * @since 3.1 */ @@ -294,9 +293,9 @@ public function getItem($pk = null) continue; } - // Convert the Table to a clean CMSObject. + // Convert the Table to a clean object. $properties = $table->getProperties(1); - $this->item[] = ArrayHelper::toObject($properties, CMSObject::class); + $this->item[] = ArrayHelper::toObject($properties); } catch (\RuntimeException $e) { $this->setError($e->getMessage()); diff --git a/libraries/src/Access/Rules.php b/libraries/src/Access/Rules.php index 5ee37eb47cc83..277f3cee31c97 100644 --- a/libraries/src/Access/Rules.php +++ b/libraries/src/Access/Rules.php @@ -9,8 +9,6 @@ namespace Joomla\CMS\Access; -use Joomla\CMS\Object\CMSObject; - // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects @@ -163,14 +161,14 @@ public function allow($action, $identity) * * @param mixed $identity An integer representing the identity or an array of identities * - * @return CMSObject Allowed actions for the identity or identities + * @return \stdClass Allowed actions for the identity or identities * * @since 1.7.0 */ public function getAllowed($identity) { // Sweep for the allowed actions. - $allowed = new CMSObject(); + $allowed = new \stdClass(); foreach ($this->data as $name => &$action) { if ($action->allow($identity)) { diff --git a/libraries/src/HTML/Helpers/AdminLanguage.php b/libraries/src/HTML/Helpers/AdminLanguage.php index 8b54fcdb2cee8..1377fab82dfd9 100644 --- a/libraries/src/HTML/Helpers/AdminLanguage.php +++ b/libraries/src/HTML/Helpers/AdminLanguage.php @@ -11,7 +11,6 @@ use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -58,7 +57,7 @@ public static function existing($all = false, $translate = false) } if ($all) { - $all_option = [new CMSObject(['value' => '*', 'text' => $translate ? Text::alt('JALL', 'language') : 'JALL_LANGUAGE'])]; + $all_option = [(object) ['value' => '*', 'text' => $translate ? Text::alt('JALL', 'language') : 'JALL_LANGUAGE']]; return array_merge($all_option, static::$items); } diff --git a/libraries/src/HTML/Helpers/ContentLanguage.php b/libraries/src/HTML/Helpers/ContentLanguage.php index f00c0f0dbd6a5..893b9f705e5e4 100644 --- a/libraries/src/HTML/Helpers/ContentLanguage.php +++ b/libraries/src/HTML/Helpers/ContentLanguage.php @@ -11,7 +11,6 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; @@ -68,7 +67,7 @@ public static function existing($all = false, $translate = false) } if ($all) { - $all_option = [new CMSObject(['value' => '*', 'text' => $translate ? Text::alt('JALL', 'language') : 'JALL_LANGUAGE'])]; + $all_option = [(object) ['value' => '*', 'text' => $translate ? Text::alt('JALL', 'language') : 'JALL_LANGUAGE']]; return array_merge($all_option, static::$items); } diff --git a/libraries/src/MVC/Controller/ApiController.php b/libraries/src/MVC/Controller/ApiController.php index 65aba3c038928..78683487879de 100644 --- a/libraries/src/MVC/Controller/ApiController.php +++ b/libraries/src/MVC/Controller/ApiController.php @@ -17,8 +17,8 @@ use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\MVC\Model\ListModel; use Joomla\CMS\MVC\View\JsonApiView; -use Joomla\CMS\Object\CMSObject; use Joomla\Input\Input; +use Joomla\Registry\Registry; use Joomla\String\Inflector; use Tobscure\JsonApi\Exception\InvalidParameterException; @@ -106,7 +106,7 @@ class ApiController extends BaseController */ public function __construct($config = [], ?MVCFactoryInterface $factory = null, ?CMSWebApplicationInterface $app = null, ?Input $input = null) { - $this->modelState = new CMSObject(); + $this->modelState = new Registry(); parent::__construct($config, $factory, $app, $input); diff --git a/libraries/src/MVC/View/ListView.php b/libraries/src/MVC/View/ListView.php index e5b6d0dc91bb3..e36f955f986dc 100644 --- a/libraries/src/MVC/View/ListView.php +++ b/libraries/src/MVC/View/ListView.php @@ -13,7 +13,6 @@ use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\FileLayout; -use Joomla\CMS\Toolbar\Toolbar; use Joomla\CMS\Toolbar\ToolbarHelper; use Joomla\Registry\Registry; diff --git a/libraries/src/TUF/DatabaseStorage.php b/libraries/src/TUF/DatabaseStorage.php index 667767a9ad34b..1267393bcaef5 100644 --- a/libraries/src/TUF/DatabaseStorage.php +++ b/libraries/src/TUF/DatabaseStorage.php @@ -11,7 +11,6 @@ use Joomla\CMS\Table\Table; use Joomla\CMS\Table\TableInterface; -use Joomla\CMS\Table\Tuf; use Tuf\Metadata\StorageBase; // phpcs:disable PSR1.Files.SideEffects diff --git a/libraries/src/User/UserHelper.php b/libraries/src/User/UserHelper.php index 3b8689b004a67..ea4e6e643c415 100644 --- a/libraries/src/User/UserHelper.php +++ b/libraries/src/User/UserHelper.php @@ -21,7 +21,6 @@ use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\Log\Log; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Session\SessionManager; use Joomla\CMS\Uri\Uri; @@ -337,7 +336,7 @@ public static function getProfile($userId = 0) // Get the dispatcher and load the user's plugins. PluginHelper::importPlugin('user'); - $data = new CMSObject(); + $data = new \stdClass(); $data->id = $userId; // Trigger the data preparation event. diff --git a/plugins/system/guidedtours/src/Extension/GuidedTours.php b/plugins/system/guidedtours/src/Extension/GuidedTours.php index 15c9e81e9f18f..97ce8324d8e16 100644 --- a/plugins/system/guidedtours/src/Extension/GuidedTours.php +++ b/plugins/system/guidedtours/src/Extension/GuidedTours.php @@ -14,7 +14,6 @@ use Joomla\CMS\Date\Date; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; -use Joomla\CMS\Object\CMSObject; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\CMS\Session\Session; use Joomla\Component\Guidedtours\Administrator\Extension\GuidedtoursComponent; @@ -283,7 +282,7 @@ private function getTour($tourId) /** * Return a tour and its steps or null if not found * - * @param CMSObject $item The tour to load + * @param \stdClass $item The tour to load * * @return null|object * diff --git a/tests/Unit/Libraries/Cms/Access/RulesTest.php b/tests/Unit/Libraries/Cms/Access/RulesTest.php index 0298ad1f3239b..8f8266ba27c55 100644 --- a/tests/Unit/Libraries/Cms/Access/RulesTest.php +++ b/tests/Unit/Libraries/Cms/Access/RulesTest.php @@ -12,7 +12,6 @@ use Joomla\CMS\Access\Rule; use Joomla\CMS\Access\Rules; -use Joomla\CMS\Object\CMSObject; use Joomla\Tests\Unit\UnitTestCase; /** @@ -340,10 +339,10 @@ public function testGetAllowed() $rules = new Rules($ruleData); $allowed = $rules->getAllowed(-42); - $this->assertInstanceOf(CMSObject::class, $allowed); - $this->assertTrue($allowed->get('create')); - $this->assertTrue($allowed->get('edit')); - $this->assertNull($allowed->get('delete')); + $this->assertInstanceOf(\stdClass::class, $allowed); + $this->assertTrue($allowed->create); + $this->assertTrue($allowed->edit); + $this->assertFalse(isset($allowed->delete)); } /**