Skip to content

Commit

Permalink
feat(phpcs): Correct all phpcs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sylus committed Nov 2, 2023
1 parent f6489d8 commit 8a577b1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
24 changes: 10 additions & 14 deletions modules/custom/wxt_core/src/CountriesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Drupal\Core\Locale\CountryManagerInterface;

/**
*
* Countries Manager.
*/
class CountriesManager {
/**
Expand Down Expand Up @@ -41,20 +41,16 @@ class CountriesManager {
protected $moduleHandler;

/**
* UpdateCommand constructor.
* CountriesManager constructor.
*
* @param \Traversable $namespaces
* The namespaces to scan for updates.
* @param \Drupal\Core\DependencyInjection\ClassResolverInterface $class_resolver
* The class resolver service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory service.
* @param \Drupal\Core\Extension\ModuleExtensionList $module_extension_list
* The module extension list.
* @param \Drupal\Component\Plugin\Discovery\DiscoveryInterface $discovery
* (optional) The update discovery handler.
* @param \phpDocumentor\Reflection\DocBlockFactoryInterface $doc_block_factory
* (optional) The doc block factory.
* @param \Drupal\Core\Locale\CountryManagerInterface $country_manager
* The module handler
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler
*/
public function __construct(ConfigFactoryInterface $config_factory, ModuleExtensionList $module_extension_list, CountryManagerInterface $country_manager, ModuleHandlerInterface $module_handler) {
$this->configFactory = $config_factory;
Expand All @@ -64,7 +60,7 @@ public function __construct(ConfigFactoryInterface $config_factory, ModuleExtens
}

/**
* Get all data (from yml) expect for this issue[#3111375] from original online PDF.
* Get all data (from yml) expect for this issue[#3111375] from original online PDF.
*/
public function getCountryData($column = 'Alpha-2', $row = 'Code') {
$module_path = $this->moduleHandler->getModule('wxt_core')->getPath();
Expand All @@ -74,7 +70,7 @@ public function getCountryData($column = 'Alpha-2', $row = 'Code') {
}
$country_names = [];

foreach ($country_data as $key => $data) {
foreach ($country_data as $data) {
$country_names[$data[$column]] = $data[$row];
}
return $country_names;
Expand Down Expand Up @@ -114,10 +110,10 @@ public function whitelistedOptions() {
public function whitelistedOptionsSorted() {
$config = $this->configFactory->get('wxt_core_countries.settings');
$whitelist = $this->whitelistedOptions();
switch ($config->get('whitelist-sort')){
switch ($config->get('whitelist-sort')) {
case 'alpha':
\ksort($whitelist);
break;
break;
}
return $whitelist;
}
Expand Down
4 changes: 2 additions & 2 deletions modules/custom/wxt_core/wxt_core.install
Original file line number Diff line number Diff line change
Expand Up @@ -672,13 +672,13 @@ function wxt_core_update_8500() {
}

/**
* Setup CountryManager lists [#3111375]
* Setup CountryManager lists [#3111375].
*/
function wxt_core_update_8501() {
$config_namespace = 'wxt_core_countries.settings';
$module_handler = \Drupal::service('module_handler');
$module_path = $module_handler->getModule('wxt_core')->getPath();
$path = DRUPAL_ROOT . '/' . $module_path . '/config/install/'. $config_namespace . '.yml';
$path = DRUPAL_ROOT . '/' . $module_path . '/config/install/' . $config_namespace . '.yml';
$country_data = Yaml::parse(\file_get_contents($path));

// Get the configuration factory service.
Expand Down
10 changes: 5 additions & 5 deletions modules/custom/wxt_ext/wxt_ext_webform/wxt_ext_webform.module
Original file line number Diff line number Diff line change
Expand Up @@ -126,22 +126,22 @@ function _gcweb_did_you_find_form_ajax_submit($form, $form_state) {
*/
function wxt_ext_webform_webform_options_country_names_alter(array &$options, array $element = []) {
$config = \Drupal::configFactory()->get('wxt_core_countries.settings');
if ($config->get('webform-override')==1){
if ($config->get('webform-override') == 1) {
$countryManager = \Drupal::service('wxt.country_whitelist');
$options = $countryManager->whitelistedOptionsSorted();
}
}

/**
* Implements hook_form_BASE_FORM_ID_form_alter() WXT Country related additions.
* Implements hook_form_BASE_FORM_ID_form_alter() for WXT Country related additions.
*/
function wxt_ext_webform_form_wxt_core_countries_settings_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
function wxt_ext_webform_form_wxt_core_countries_settings_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$form['webform-box'] = [
'#weight' => -1,
'#type' => 'fieldset',
'#title' => t('WxT Extend Webform'),
];
$link = Link::createFromRoute(t('Webform Country Name Options'),'entity.webform_options.edit_form', ['webform_options'=>'country_names']);
$link = Link::createFromRoute(t('Webform Country Name Options'), 'entity.webform_options.edit_form', ['webform_options' => 'country_names']);
$form['webform-box']['webform-override'] = [
'#type' => 'checkbox',
'#title' => t('Override Webform Options for Country Names'),
Expand All @@ -154,7 +154,7 @@ function wxt_ext_webform_form_wxt_core_countries_settings_form_alter(&$form, \Dr
/**
* Process new field added to form.
*/
function wxt_ext_webform_form_wxt_core_countries_submit(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
function wxt_ext_webform_form_wxt_core_countries_submit(&$form, FormStateInterface $form_state) {
\Drupal::configFactory()
->getEditable('wxt_core_countries.settings')
->set('webform-override', $form_state->getValue('webform-override'))
Expand Down

0 comments on commit 8a577b1

Please sign in to comment.