3declare(strict_types=1);
9final class LocatorCodesTemplate
implements Template
11 public function __construct(
12 private readonly
string $code,
13 private readonly
string $module,
14 private readonly
array $services,
15 private readonly
bool $withTag =
false,
21 public function getContent(): string
23 $names = $this->getNamesString();
25 $codes = $this->getCodesString();
27 $startTag = $this->withTag ?
"<?php\n\nnamespace PHPSTORM_META\n{" :
'';
28 $endTag = $this->withTag ?
'}' :
'';
30 $startRegion = $this->withTag ?
"#region autogenerated services for module {$this->module}\n\n" :
'';
31 $endRegion = $this->withTag ?
"\n\n#endregion\n" :
'';
41 expectedArguments(\
Bitrix\
Main\
DI\ServiceLocator::get(), 0, argumentsSet(
'{$this->code}'));
54 private function getNamesString(): string
56 $separator = $this->withTag ?
"',\n\t\t\t'" :
"',\n\t\t'";
58 return "\t'" . implode($separator, array_keys($this->services)) .
"',";
61 private function getCodesString(): string
63 $map = $this->services;
64 array_walk(
$map,
static function(
string &$value,
string $key):
void {
65 $value =
"'{$key}' => {$value},";
69 $separator = $this->withTag ?
"\n\t\t\t\t" :
"\n\t\t\t";
71 return "\t" . implode($separator,
$map);
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
if(empty($signedUserToken)) $key