[ticket/15245] Fix comments, class names and code style

PHPBB3-15245
This commit is contained in:
Oliver Schramm 2017-09-28 23:55:28 +02:00
parent 3da67ce581
commit 221e5a01b1
3 changed files with 30 additions and 13 deletions

View file

@ -18,6 +18,7 @@ services:
class: phpbb\feed\helper class: phpbb\feed\helper
arguments: arguments:
- '@config' - '@config'
- '@service_container'
- '@path_helper' - '@path_helper'
- '@text_formatter.renderer' - '@text_formatter.renderer'
- '@user' - '@user'
@ -78,6 +79,10 @@ services:
- '@dispatcher' - '@dispatcher'
- '%core.php_ext%' - '%core.php_ext%'
feed.quote_helper:
class: phpbb\feed\quote_helper
parent: text_formatter.s9e.quote_helper
feed.topic: feed.topic:
class: phpbb\feed\topic class: phpbb\feed\topic
shared: false shared: false

View file

@ -13,41 +13,52 @@
namespace phpbb\feed; namespace phpbb\feed;
use phpbb\config\config;
use phpbb\path_helper;
use phpbb\textformatter\s9e\renderer;
use phpbb\user;
use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Class with some helpful functions used in feeds * Class with some helpful functions used in feeds
*/ */
class helper class helper
{ {
/** @var \phpbb\config\config */ /** @var config */
protected $config; protected $config;
/** @var \phpbb\path_helper */ /** @var ContainerInterface */
protected $container;
/** @var path_helper */
protected $path_helper; protected $path_helper;
/** @var \phpbb\textformatter\s9e\renderer */ /** @var renderer */
protected $renderer; protected $renderer;
/** @var \phpbb\user */ /** @var user */
protected $user; protected $user;
/** /**
* Constructor * Constructor
* *
* @param \phpbb\config\config $config Config object * @param config $config Config object
* @param \phpbb\path_helper $path_helper Path helper object * @param ContainerInterface $container Service container object
* @param \phpbb\textformatter\s9e\renderer $renderer TextFormatter renderer object * @param path_helper $path_helper Path helper object
* @param \phpbb\user $user User object * @param renderer $renderer TextFormatter renderer object
* @param user $user User object
*/ */
public function __construct(\phpbb\config\config $config, \phpbb\path_helper $path_helper, \phpbb\textformatter\s9e\renderer $renderer, \phpbb\user $user) public function __construct(config $config, ContainerInterface $container, path_helper $path_helper, renderer $renderer, user $user)
{ {
$this->config = $config; $this->config = $config;
$this->container = $container;
$this->path_helper = $path_helper; $this->path_helper = $path_helper;
$this->renderer = $renderer; $this->renderer = $renderer;
$this->user = $user; $this->user = $user;
} }
/** /**
* Run links through append_sid(), prepend generate_board_url() and remove session id * Returns the board url (and caches it in the function)
*/ */
public function get_board_url() public function get_board_url()
{ {
@ -105,7 +116,7 @@ class helper
} }
// Setup our own quote_helper to remove all attributes from quotes // Setup our own quote_helper to remove all attributes from quotes
$this->renderer->configure_quote_helper(new feed_quote_helper($this->user, $this->path_helper->get_phpbb_root_path(), $this->path_helper->get_php_ext())); $this->renderer->configure_quote_helper($this->container->get('feed.quote_helper'));
$this->renderer->set_smilies_path($this->get_board_url() . '/' . $this->config['smilies_path']); $this->renderer->set_smilies_path($this->get_board_url() . '/' . $this->config['smilies_path']);

View file

@ -16,7 +16,7 @@ namespace phpbb\feed;
/** /**
* Modified quote_helper for feeds (basically just removing all attributes) * Modified quote_helper for feeds (basically just removing all attributes)
*/ */
class feed_quote_helper extends \phpbb\textformatter\s9e\quote_helper class quote_helper extends \phpbb\textformatter\s9e\quote_helper
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
@ -27,7 +27,8 @@ class feed_quote_helper extends \phpbb\textformatter\s9e\quote_helper
return \s9e\TextFormatter\Utils::replaceAttributes( return \s9e\TextFormatter\Utils::replaceAttributes(
$xml, $xml,
'QUOTE', 'QUOTE',
function () { function ()
{
return []; return [];
} }
); );