1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-12 03:34:04 +02:00

[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
This commit is contained in:
s9e
2015-02-04 23:07:58 +01:00
committed by JoshyPHP
parent e0bb446c57
commit 72fb380c9f
3 changed files with 11 additions and 11 deletions

View File

@@ -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;