|
|
@@ -9,15 +9,17 @@ use Symfony\Component\Console\Helper\TableStyle;
|
|
9
|
9
|
|
|
10
|
10
|
class PortfolioPresenter
|
|
11
|
11
|
{
|
|
12
|
|
- private const SecurityMapPrint = [
|
|
13
|
|
- ['RU000A1014L8', 'RU000A107UL4', '(в пути)'], ['LQDT', 'T', '±'],
|
|
14
|
|
- ];
|
|
15
|
|
-
|
|
16
|
12
|
private const FONT_SIZE = 12;
|
|
17
|
13
|
private const FONT_NAME = 'droid_sans_mono';
|
|
18
|
14
|
private const COPYRIGHT_MARK = ' ©ЕИ';
|
|
|
15
|
+ private array $securityMapPrintable = [['(в пути)'], ['±']];
|
|
|
16
|
+ private array $mapSecurityTitle = [];
|
|
19
|
17
|
|
|
20
|
|
- private array $MapSecuritiesPrintable = [];
|
|
|
18
|
+ public function __construct(array $securitiesMap)
|
|
|
19
|
+ {
|
|
|
20
|
+ array_unshift($this->securityMapPrintable[0], ...array_keys($securitiesMap));
|
|
|
21
|
+ array_unshift($this->securityMapPrintable[1], ...array_values($securitiesMap));
|
|
|
22
|
+ }
|
|
21
|
23
|
|
|
22
|
24
|
public function toImage(ParsedPortfolio $parsedPortfolio, string $filename): void
|
|
23
|
25
|
{
|
|
|
@@ -118,14 +120,14 @@ class PortfolioPresenter
|
|
118
|
120
|
|
|
119
|
121
|
private function getPrintableSecurityTitle(array $security): string
|
|
120
|
122
|
{
|
|
121
|
|
- $security['ЦБ'] = str_replace(self::SecurityMapPrint[0], self::SecurityMapPrint[1], $security['ЦБ']);
|
|
|
123
|
+ $security['ЦБ'] = str_replace($this->securityMapPrintable[0], $this->securityMapPrintable[1], $security['ЦБ']);
|
|
122
|
124
|
|
|
123
|
125
|
if (!str_starts_with($security['ЦБ'], 'RU00')) {
|
|
124
|
126
|
return $security['ЦБ'];
|
|
125
|
127
|
}
|
|
126
|
128
|
|
|
127
|
|
- if (isset($this->MapSecuritiesPrintable[$security['ЦБ']])) {
|
|
128
|
|
- return $this->MapSecuritiesPrintable[$security['ЦБ']];
|
|
|
129
|
+ if (isset($this->mapSecurityTitle[$security['ЦБ']])) {
|
|
|
130
|
+ return $this->mapSecurityTitle[$security['ЦБ']];
|
|
129
|
131
|
}
|
|
130
|
132
|
|
|
131
|
133
|
if (!isset($security['Эмитент'])) {
|
|
|
@@ -133,7 +135,7 @@ class PortfolioPresenter
|
|
133
|
135
|
}
|
|
134
|
136
|
|
|
135
|
137
|
$title = str_replace(['МКПАО', 'ПАО', '"', ' ', '(', ')'], ['', '', '', '', '', ''], $security['Эмитент']);
|
|
136
|
|
- $this->MapSecuritiesPrintable[$security['ЦБ']] = $title;
|
|
|
138
|
+ $this->mapSecurityTitle[$security['ЦБ']] = $title;
|
|
137
|
139
|
|
|
138
|
140
|
return $title;
|
|
139
|
141
|
}
|