Commit 2411190a authored by gbyte.co's avatar gbyte.co

Improve code documentation

parent d6ef5363
......@@ -34,6 +34,7 @@ services:
class: Drupal\simple_sitemap\Batch\BatchUrlGenerator
public: true
arguments:
- '@simple_sitemap.generator'
- '@simple_sitemap.sitemap_generator'
- '@language_manager'
- '@entity_type.manager'
......
......@@ -7,6 +7,7 @@ use Drupal\Component\Utility\Html;
use Drupal\Core\Cache\Cache;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\simple_sitemap\Logger;
use Drupal\simple_sitemap\Simplesitemap;
use Drupal\simple_sitemap\SitemapGenerator;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
......@@ -28,6 +29,7 @@ class BatchUrlGenerator {
const REGENERATION_FINISHED_MESSAGE = "The <a href='@url' target='_blank'>XML sitemap</a> has been regenerated for all languages.";
const REGENERATION_FINISHED_ERROR_MESSAGE = 'The sitemap generation finished with an error.';
protected $generator;
protected $sitemapGenerator;
protected $languageManager;
protected $languages;
......@@ -44,6 +46,7 @@ class BatchUrlGenerator {
/**
* BatchUrlGenerator constructor.
*
* @param $generator
* @param $sitemap_generator
* @param $language_manager
* @param $entity_type_manager
......@@ -52,14 +55,16 @@ class BatchUrlGenerator {
* @param $logger
*/
public function __construct(
SitemapGenerator $sitemap_generator,
Simplesitemap $generator,
SitemapGenerator $sitemap_generator, //todo: use $this->generator->sitemapGenerator instead?
LanguageManagerInterface $language_manager,
EntityTypeManagerInterface $entity_type_manager,
PathValidator $path_validator,
QueryFactory $entity_query,
Logger $logger
) {
// Todo using only one method, maybe make method static instead?
$this->generator = $generator;
// todo: using only one method, maybe make method static instead?
$this->sitemapGenerator = $sitemap_generator;
$this->languageManager = $language_manager;
$this->languages = $language_manager->getLanguages();
......
......@@ -7,6 +7,7 @@ use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Drupal\simple_sitemap\Simplesitemap;
/**
* Class SimplesitemapController.
......@@ -28,7 +29,7 @@ class SimplesitemapController extends ControllerBase {
* @param \Drupal\simple_sitemap\Simplesitemap $generator
* The sitemap generator.
*/
public function __construct($generator) {
public function __construct(Simplesitemap $generator) {
$this->generator = $generator;
}
......
......@@ -3,6 +3,8 @@
namespace Drupal\simple_sitemap\Form;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\simple_sitemap\Simplesitemap;
use Drupal\Core\Session\AccountProxyInterface;
/**
* Class FormHelper.
......@@ -45,7 +47,10 @@ class FormHelper {
* @param $generator
* @param $current_user
*/
public function __construct($generator, $current_user) {
public function __construct(
Simplesitemap $generator,
AccountProxyInterface $current_user
) {
$this->generator = $generator;
$this->currentUser = $current_user;
}
......
......@@ -4,7 +4,9 @@ namespace Drupal\simple_sitemap;
use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\simple_sitemap\Form\FormHelper;
use Drupal\simple_sitemap\SitemapGenerator;
use Drupal\Core\Database\Connection;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Path\PathValidator;
/**
* Class Simplesitemap.
......@@ -36,9 +38,9 @@ class Simplesitemap {
public function __construct(
SitemapGenerator $sitemapGenerator,
$configFactoryInterface,
$database,
$entityTypeManager,
$pathValidator,
Connection $database,
EntityTypeManagerInterface $entityTypeManager,
PathValidator $pathValidator,
$dateFormatter
) {
$this->sitemapGenerator = $sitemapGenerator;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment