diff options
author | s9e <s9e.dev@gmail.com> | 2015-02-04 23:07:58 +0100 |
---|---|---|
committer | JoshyPHP <s9e.dev@gmail.com> | 2015-04-02 19:16:01 +0200 |
commit | 72fb380c9fbb0d6fa51236bdc179ba7ef6126a5a (patch) | |
tree | 11faf4a7b94b8ba93ebc517d055df734437386fa | |
parent | [ticket/11768] Reorganized code for readability (diff) | |
download | phpbb-72fb380c9fbb0d6fa51236bdc179ba7ef6126a5a.tar.gz phpbb-72fb380c9fbb0d6fa51236bdc179ba7ef6126a5a.tar.bz2 phpbb-72fb380c9fbb0d6fa51236bdc179ba7ef6126a5a.zip |
[ticket/11768] Updated constructors with explicit dependencies
The trade-off is that an instance of phpbb\textformatter\s9e\factory and
phpbb\textformatter\data_access is created on any page that uses the
parser or the renderer, even when neither need to be regenerated. It has
no measureable impact on performance and costs ~20KB of RAM.
PHPBB3-11768
-rw-r--r-- | phpBB/config/default/container/services_text_formatter.yml | 4 | ||||
-rw-r--r-- | phpBB/phpbb/textformatter/s9e/parser.php | 6 | ||||
-rw-r--r-- | phpBB/phpbb/textformatter/s9e/renderer.php | 12 |
3 files changed, 11 insertions, 11 deletions
diff --git a/phpBB/config/default/container/services_text_formatter.yml b/phpBB/config/default/container/services_text_formatter.yml index 7d21e4498e..3d5fb3766d 100644 --- a/phpBB/config/default/container/services_text_formatter.yml +++ b/phpBB/config/default/container/services_text_formatter.yml @@ -41,7 +41,7 @@ services: - @cache.driver - %text_formatter.cache.parser.key% - @user - - @service_container + - @text_formatter.s9e.factory text_formatter.s9e.renderer: class: phpbb\textformatter\s9e\renderer @@ -49,7 +49,7 @@ services: - @cache.driver - %text_formatter.cache.dir% - %text_formatter.cache.renderer.key% - - @service_container + - @text_formatter.s9e.factory calls: - [configure_smilies_path, [@config, @path_helper]] - [configure_user, [@user, @config, @auth]] diff --git a/phpBB/phpbb/textformatter/s9e/parser.php b/phpBB/phpbb/textformatter/s9e/parser.php index 58cef8fa9e..d9f693ba18 100644 --- a/phpBB/phpbb/textformatter/s9e/parser.php +++ b/phpBB/phpbb/textformatter/s9e/parser.php @@ -39,17 +39,17 @@ class parser extends \phpbb\textformatter\parser * @param phpbb\cache\driver_interface $cache * @param string $key Cache key * @param phpbb\user $user - * @param ContainerInterface $container + * @param factory $factory * @return null */ - public function __construct(\phpbb\cache\driver\driver_interface $cache, $key, \phpbb\user $user, ContainerInterface $container) + public function __construct(\phpbb\cache\driver\driver_interface $cache, $key, \phpbb\user $user, factory $factory) { $this->user = $user; $parser = $cache->get($key); if (!$parser) { - list($parser) = $container->get('text_formatter.s9e.factory')->regenerate(); + list($parser) = $factory->regenerate(); } $this->parser = $parser; diff --git a/phpBB/phpbb/textformatter/s9e/renderer.php b/phpBB/phpbb/textformatter/s9e/renderer.php index c724be7cfe..9fe538e35d 100644 --- a/phpBB/phpbb/textformatter/s9e/renderer.php +++ b/phpBB/phpbb/textformatter/s9e/renderer.php @@ -49,13 +49,13 @@ class renderer extends \phpbb\textformatter\renderer /** * Constructor * - * @param phpbb\cache\driver\driver_interface $cache - * @param string $cache_dir Path to the cache dir - * @param string $key Cache key - * @param ContainerInterface $container + * @param \phpbb\cache\driver\driver_interface $cache + * @param string $cache_dir Path to the cache dir + * @param string $key Cache key + * @param factory $factory * @return null */ - public function __construct(\phpbb\cache\driver\driver_interface $cache, $cache_dir, $key, ContainerInterface $container) + public function __construct(\phpbb\cache\driver\driver_interface $cache, $cache_dir, $key, factory $factory) { $renderer_data = $cache->get($key); @@ -82,7 +82,7 @@ class renderer extends \phpbb\textformatter\renderer if (!isset($renderer)) { - list(, $renderer) = $container->get('text_formatter.s9e.factory')->regenerate(); + list(, $renderer) = $factory->regenerate(); } $this->renderer = $renderer; |