diff options
Diffstat (limited to 'application/formatter/FormatterFactory.php')
-rw-r--r-- | application/formatter/FormatterFactory.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/application/formatter/FormatterFactory.php b/application/formatter/FormatterFactory.php index 0d2c0466..5f282f68 100644 --- a/application/formatter/FormatterFactory.php +++ b/application/formatter/FormatterFactory.php | |||
@@ -16,14 +16,19 @@ class FormatterFactory | |||
16 | /** @var ConfigManager instance */ | 16 | /** @var ConfigManager instance */ |
17 | protected $conf; | 17 | protected $conf; |
18 | 18 | ||
19 | /** @var bool */ | ||
20 | protected $isLoggedIn; | ||
21 | |||
19 | /** | 22 | /** |
20 | * FormatterFactory constructor. | 23 | * FormatterFactory constructor. |
21 | * | 24 | * |
22 | * @param ConfigManager $conf | 25 | * @param ConfigManager $conf |
26 | * @param bool $isLoggedIn | ||
23 | */ | 27 | */ |
24 | public function __construct(ConfigManager $conf) | 28 | public function __construct(ConfigManager $conf, bool $isLoggedIn) |
25 | { | 29 | { |
26 | $this->conf = $conf; | 30 | $this->conf = $conf; |
31 | $this->isLoggedIn = $isLoggedIn; | ||
27 | } | 32 | } |
28 | 33 | ||
29 | /** | 34 | /** |
@@ -33,7 +38,7 @@ class FormatterFactory | |||
33 | * | 38 | * |
34 | * @return BookmarkFormatter instance. | 39 | * @return BookmarkFormatter instance. |
35 | */ | 40 | */ |
36 | public function getFormatter($type = null) | 41 | public function getFormatter(string $type = null) |
37 | { | 42 | { |
38 | $type = $type ? $type : $this->conf->get('formatter', 'default'); | 43 | $type = $type ? $type : $this->conf->get('formatter', 'default'); |
39 | $className = '\\Shaarli\\Formatter\\Bookmark'. ucfirst($type) .'Formatter'; | 44 | $className = '\\Shaarli\\Formatter\\Bookmark'. ucfirst($type) .'Formatter'; |
@@ -41,6 +46,6 @@ class FormatterFactory | |||
41 | $className = '\\Shaarli\\Formatter\\BookmarkDefaultFormatter'; | 46 | $className = '\\Shaarli\\Formatter\\BookmarkDefaultFormatter'; |
42 | } | 47 | } |
43 | 48 | ||
44 | return new $className($this->conf); | 49 | return new $className($this->conf, $this->isLoggedIn); |
45 | } | 50 | } |
46 | } | 51 | } |