Skip to content
Snippets Groups Projects
Commit df405a88 authored by Michael Mwebaze's avatar Michael Mwebaze
Browse files

fixing phpcs related issues

parent 96f9b962
Branches 2.0.x
No related tags found
No related merge requests found
Pipeline #231786 passed with warnings
......@@ -21,20 +21,38 @@ use Drupal\Core\Config\ConfigFactoryInterface;
*/
class FieldUpdaterService implements FieldUpdaterServiceInterface {
use StringTranslationTrait;
/** @var EntityTypeManagerInterface */
protected EntityTypeManagerInterface $entityTypeManager;
/** @var Connection */
protected Connection $connection;
/** @var ConfigFactoryInterface */
protected ConfigFactoryInterface $configFactory;
/** @var MessengerInterface */
protected MessengerInterface $messenger;
/** @var EntityFieldManagerInterface */
protected EntityFieldManagerInterface $entityFieldManager;
/**
* FieldUpdaterService constructor.
*
* @param Connection $connection
* The database connection service.
*
* @param EntityTypeManagerInterface $entityTypeManager
* The entity type manager service interface.
*
* @param ConfigFactoryInterface $configFactory
* The config factory service interface.
*
* @param MessengerInterface $messenger
* The messenger service interface.
*
* @param EntityFieldManagerInterface $entityFieldManager
* The entity field manager service interface.
*/
public function __construct(Connection $connection, EntityTypeManagerInterface $entityTypeManager,
ConfigFactoryInterface $configFactory, MessengerInterface $messenger, EntityFieldManagerInterface $entityFieldManager) {
......
......@@ -5,13 +5,12 @@ namespace Drupal\integer_to_decimal\Service;
use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
/**
* provides an interface for Field Updater services.
* Provides an interface for Field Updater services.
*
*/
interface FieldUpdaterServiceInterface
{
interface FieldUpdaterServiceInterface {
/**
* Updates a given field with the new precision and scale.
*
* @param string $field
* Machine name of the field
......
......@@ -3,26 +3,30 @@
namespace Drupal\integer_to_decimal\Util;
/**
* A utility class that extracts the content type from the url
* A utility class that extracts the content type from the url.
*
* @package Drupal\field_updater\Util
*/
class EntityFromUri
{
class EntityFromUri {
/**
* Gets the current entity type for the URI.
*
* @return string id of the bundle or content type
*/
public static function currentUriEntity()
public static function currentUriEntity(): string
{
$currentUri = \Drupal::request()->getRequestUri();
return explode('/', $currentUri)[5];
}
/**
* Gets the field from URI.
*
* @return string field name being updated from integer to decimal
*/
public static function currentUriField(){
public static function currentUriField(): string
{
$currentUri = \Drupal::request()->getRequestUri();
return explode('.', explode('/', $currentUri)[7])[2];
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment