/** @var ConfigManager instance */
protected $conf;
+ /** @var bool */
+ protected $isLoggedIn;
+
/**
* FormatterFactory constructor.
*
* @param ConfigManager $conf
+ * @param bool $isLoggedIn
*/
- public function __construct(ConfigManager $conf)
+ public function __construct(ConfigManager $conf, bool $isLoggedIn)
{
$this->conf = $conf;
+ $this->isLoggedIn = $isLoggedIn;
}
/**
*
* @return BookmarkFormatter instance.
*/
- public function getFormatter($type = null)
+ public function getFormatter(string $type = null): BookmarkFormatter
{
$type = $type ? $type : $this->conf->get('formatter', 'default');
- $className = '\\Shaarli\\Formatter\\Bookmark'. ucfirst($type) .'Formatter';
+ $className = '\\Shaarli\\Formatter\\Bookmark' . ucfirst($type) . 'Formatter';
if (!class_exists($className)) {
$className = '\\Shaarli\\Formatter\\BookmarkDefaultFormatter';
}
- return new $className($this->conf);
+ return new $className($this->conf, $this->isLoggedIn);
}
}