29
0
mirror of https://github.com/joomla/joomla-cms.git synced 2024-06-27 15:43:43 +00:00

[4.0] Codestyle fixes for new CMS codestyle Batch 12/16? (#25466)

This commit is contained in:
Hannes Papenberg 2019-07-12 00:02:11 +02:00 committed by George Wilson
parent 2dc9ebd820
commit d24f476c32
20 changed files with 143 additions and 84 deletions

View File

@ -22,6 +22,11 @@ use Joomla\CMS\Form\Field\ListField;
*/
class FieldcontextsField extends ListField
{
/**
* Type of the field
*
* @var string
*/
public $type = 'Fieldcontexts';
/**

View File

@ -21,6 +21,11 @@ use Joomla\CMS\Form\Field\ListField;
*/
class SectionField extends ListField
{
/**
* Type of the field
*
* @var string
*/
public $type = 'Section';
/**

View File

@ -12,6 +12,7 @@ namespace Joomla\Component\Contact\Site\Model;
defined('_JEXEC') or die;
use Joomla\CMS\Categories\Categories;
use Joomla\CMS\Categories\CategoryNode;
use Joomla\CMS\Factory;
use Joomla\CMS\MVC\Model\ListModel;
use Joomla\Registry\Registry;
@ -37,8 +38,18 @@ class CategoriesModel extends ListModel
*/
protected $_extension = 'com_contact';
/**
* Parent category of the current one
*
* @var CategoryNode|null
*/
private $_parent = null;
/**
* Array of child-categories
*
* @var CategoryNode[]|null
*/
private $_items = null;
/**

View File

@ -12,6 +12,7 @@ namespace Joomla\Component\Contact\Site\Model;
defined('_JEXEC') or die;
use Joomla\CMS\Categories\Categories;
use Joomla\CMS\Categories\CategoryNode;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Helper\TagsHelper;
@ -31,18 +32,38 @@ use Joomla\Registry\Registry;
class CategoryModel extends ListModel
{
/**
* Category items data
* Category item data
*
* @var array
* @var CategoryNode
*/
protected $_item = null;
/**
* Array of contacts in the category
*
* @var \stdClass[]
*/
protected $_articles = null;
/**
* Category left and right of this one
*
* @var CategoryNode[]|null
*/
protected $_siblings = null;
/**
* Array of child-categories
*
* @var CategoryNode[]|null
*/
protected $_children = null;
/**
* Parent category of the current one
*
* @var CategoryNode|null
*/
protected $_parent = null;
/**

View File

@ -29,6 +29,11 @@ use Joomla\Database\DatabaseInterface;
*/
class Router extends RouterView
{
/**
* Flag to remove IDs
*
* @var boolean
*/
protected $noIDs = false;
/**

View File

@ -23,6 +23,7 @@ class WebAssetRegistry implements WebAssetRegistryInterface
/**
* Files with Asset info. File path should be relative.
*
* @var array
* @example of data file:
*
* {
@ -62,8 +63,6 @@ class WebAssetRegistry implements WebAssetRegistryInterface
* ]
* }
*
* @var array
*
* @since 4.0.0
*/
protected $dataFilesNew = [];
@ -147,7 +146,7 @@ class WebAssetRegistry implements WebAssetRegistryInterface
*
* @param string $name Asset name
*
* @return bool
* @return boolean
*
* @since 4.0.0
*/
@ -168,8 +167,8 @@ class WebAssetRegistry implements WebAssetRegistryInterface
*/
public function createAsset(string $name, array $data = []): WebAssetItem
{
$nameSpace = array_key_exists('namespace', $data) ? $data['namespace'] : __NAMESPACE__ . '\\AssetItem';
$className = array_key_exists('class', $data) ? $data['class'] : null;
$nameSpace = array_key_exists('namespace', $data) ? $data['namespace'] : __NAMESPACE__ . '\\AssetItem';
$className = array_key_exists('class', $data) ? $data['class'] : null;
if ($className && class_exists($nameSpace . '\\' . $className))
{

View File

@ -59,7 +59,7 @@ interface WebAssetRegistryInterface
*
* @param string $name Asset name
*
* @return bool
* @return boolean
*
* @since 4.0.0
*/

View File

@ -147,7 +147,7 @@ abstract class ArticlesNewsHelper
$item->imageSrc = htmlspecialchars($images->image_intro, ENT_COMPAT, 'UTF-8');
$item->imageAlt = htmlspecialchars($images->image_intro_alt, ENT_COMPAT, 'UTF-8');
if ($images->image_intro_caption)
if ($images->image_intro_caption)
{
$item->imageCaption = htmlspecialchars($images->image_intro_caption, ENT_COMPAT, 'UTF-8');
}
@ -157,7 +157,7 @@ abstract class ArticlesNewsHelper
$item->imageSrc = htmlspecialchars($images->image_fulltext, ENT_COMPAT, 'UTF-8');
$item->imageAlt = htmlspecialchars($images->image_fulltext_alt, ENT_COMPAT, 'UTF-8');
if ($images->image_intro_caption)
if ($images->image_intro_caption)
{
$item->imageCaption = htmlspecialchars($images->image_fulltext_caption, ENT_COMPAT, 'UTF-8');
}

View File

@ -290,6 +290,7 @@ class PlgFinderCategories extends FinderIndexerAdapter
* Add the metadata processing instructions based on the category's
* configuration parameters.
*/
// Add the meta author.
$item->metaauthor = $item->metadata->get('author');
@ -370,43 +371,43 @@ class PlgFinderCategories extends FinderIndexerAdapter
$query->select(
$db->quoteName(
[
'a.id',
'a.title',
'a.alias',
'a.extension',
'a.metakey',
'a.metadesc',
'a.metadata',
'a.language',
'a.lft',
'a.parent_id',
'a.level',
'a.access',
'a.params',
]
)
)
->select(
$db->quoteName(
[
'a.id',
'a.title',
'a.alias',
'a.extension',
'a.metakey',
'a.metadesc',
'a.metadata',
'a.language',
'a.lft',
'a.parent_id',
'a.level',
'a.access',
'a.params',
'a.description',
'a.created_user_id',
'a.modified_time',
'a.modified_user_id',
'a.created_time',
'a.published'
],
[
'summary',
'created_by',
'modified',
'modified_by',
'start_date',
'state'
]
)
)
->select(
$db->quoteName(
[
'a.description',
'a.created_user_id',
'a.modified_time',
'a.modified_user_id',
'a.created_time',
'a.published'
],
[
'summary',
'created_by',
'modified',
'modified_by',
'start_date',
'state'
]
)
);
);
// Handle the alias CASE WHEN portion of the query.
$case_when_item_alias = ' CASE WHEN ';
@ -437,33 +438,33 @@ class PlgFinderCategories extends FinderIndexerAdapter
$query = $this->db->getQuery(true);
$query->select(
$query->quoteName(
[
'a.id',
'a.parent_id',
'a.access'
]
)
)
->select(
$query->quoteName(
[
'a.id',
'a.parent_id',
'a.access'
'a.' . $this->state_field,
'c.published',
'c.access'
],
[
'state',
'cat_state',
'cat_access'
]
)
)
->select(
$query->quoteName(
[
'a.' . $this->state_field,
'c.published',
'c.access'
],
[
'state',
'cat_state',
'cat_access'
]
)
)
->from($query->quoteName('#__categories', 'a'))
->leftJoin(
$query->quoteName('#__categories', 'c'),
$query->quoteName('c.id') . ' = ' . $query->quoteName('a.parent_id')
);
->from($query->quoteName('#__categories', 'a'))
->leftJoin(
$query->quoteName('#__categories', 'c'),
$query->quoteName('c.id') . ' = ' . $query->quoteName('a.parent_id')
);
return $query;
}

View File

@ -284,6 +284,7 @@ class PlgFinderContacts extends FinderIndexerAdapter
* Add the metadata processing instructions based on the contact
* configuration parameters.
*/
// Handle the contact position.
if ($item->params->get('show_position', true))
{

View File

@ -277,6 +277,7 @@ class PlgFinderNewsfeeds extends FinderIndexerAdapter
* Add the metadata processing instructions based on the newsfeeds
* configuration parameters.
*/
// Add the meta author.
$item->metaauthor = $item->metadata->get('author');

View File

@ -9,6 +9,7 @@
defined('_JEXEC') or die;
use Joomla\CMS\Application\CMSApplicationInterface;
use Joomla\CMS\Date\Date;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
@ -25,6 +26,7 @@ class PlgInstallerOverride extends CMSPlugin
/**
* Application object.
*
* @var CMSApplicationInterface
*/
protected $app;
@ -368,16 +370,16 @@ class PlgInstallerOverride extends CMSPlugin
->bind(':pkId', $pk->id)
->bind(':exId', $pk->extension_id, ParameterType::INTEGER);
try
{
// Set the query using our newly populated query object and execute it.
$db->setQuery($updateQuery);
$db->execute();
}
catch (\RuntimeException $e)
{
return $e;
}
try
{
// Set the query using our newly populated query object and execute it.
$db->setQuery($updateQuery);
$db->execute();
}
catch (\RuntimeException $e)
{
return $e;
}
continue;
}

View File

@ -39,7 +39,7 @@ return new class implements ServiceProviderInterface
return new Joomlaupdate(
$container->get(DispatcherInterface::class),
Factory::getApplication()->getDocument(),
(array)$plugin
(array) $plugin
);
}
);

View File

@ -115,7 +115,7 @@ class PlgSampledataBlog extends CMSPlugin
// Detect language to be used.
$language = Multilanguage::isEnabled() ? Factory::getLanguage()->getTag() : '*';
$langSuffix = ($language !== '*') ? ' (' . $language . ')' : '';
$langSuffix = ($language !== '*') ? ' (' . $language . ')' : '';
$workflow_id = 1;

View File

@ -115,7 +115,7 @@ class InfoCollector extends AbstractDataCollector implements AssetProvider
*/
public function collect(): array
{
/* @type SiteApplication|AdministratorApplication $application */
/** @type SiteApplication|AdministratorApplication $application */
$application = Factory::getApplication();
$model = $application->bootComponent('com_admin')

View File

@ -53,6 +53,7 @@ class LanguageFilesCollector extends AbstractDataCollector implements AssetProvi
foreach ($paths as $extension => $files)
{
$loaded[$extension] = [];
foreach ($files as $file => $status)
{
$loaded[$extension][$file] = $status;

View File

@ -73,6 +73,7 @@ class FileStorage extends \DebugBar\Storage\FileStorage
{
// Loop through all .php files and remember the modified time and id.
$files = [];
foreach (new \DirectoryIterator($this->dirname) as $file)
{
if ($file->getExtension() == 'php')
@ -95,6 +96,7 @@ class FileStorage extends \DebugBar\Storage\FileStorage
// Load the metadata and filter the results.
$results = [];
$i = 0;
foreach ($files as $file)
{
// When filter is empty, skip loading the offset

View File

@ -305,6 +305,7 @@ class PlgSystemDebug extends CMSPlugin
if (Factory::getDocument()->getType() !== 'html')
{
$this->debugBar->stackData();
return;
}
@ -355,8 +356,8 @@ class PlgSystemDebug extends CMSPlugin
{
case 'openhandler':
$handler = new OpenHandler($this->debugBar);
return $handler->handle($this->app->input->request->getArray(), false, false);
break;
default:
return '';
}
@ -579,6 +580,7 @@ class PlgSystemDebug extends CMSPlugin
$this->debugBar->addCollector(new MessagesCollector('deprecated'));
$this->debugBar->addCollector(new MessagesCollector('deprecation-notes'));
}
if ($logDeprecatedCore)
{
$this->debugBar->addCollector(new MessagesCollector('deprecated-core'));
@ -599,6 +601,7 @@ class PlgSystemDebug extends CMSPlugin
{
break;
}
$file = $entry->callStack[2]['file'] ?? '';
$line = $entry->callStack[2]['line'] ?? '';
@ -620,6 +623,7 @@ class PlgSystemDebug extends CMSPlugin
{
break;
}
$category .= '-core';
}
elseif (!$logDeprecated)
@ -659,6 +663,7 @@ class PlgSystemDebug extends CMSPlugin
default:
$level = 'info';
}
$this->debugBar['log']->addMessage($entry->category . ' - ' . $entry->message, $level);
break;
}

View File

@ -27,7 +27,7 @@ class PlgSystemLanguagecode extends CMSPlugin
* @var \Joomla\CMS\Application\CMSApplication
* @since 4.0.0
*/
protected $app;
protected $app;
/**
* Plugin that changes the language code used in the <html /> tag.
@ -158,8 +158,8 @@ class PlgSystemLanguagecode extends CMSPlugin
/>
</fieldset>
</fields>
</form>
');
</form>'
);
}
}

View File

@ -230,7 +230,7 @@ class PlgSystemPrivacyconsent extends JPlugin
BaseDatabaseModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_actionlogs/models', 'ActionlogsModel');
/* @var ActionlogsModelActionlog $model */
/** @var ActionlogsModelActionlog $model */
$model = BaseDatabaseModel::getInstance('Actionlog', 'ActionlogsModel');
$model->addLog(array($message), 'PLG_SYSTEM_PRIVACYCONSENT_CONSENT', 'plg_system_privacyconsent', $userId);
}