'smarty_name'] */ public $scope; /** * @return bool */ public function isRequired(): ?bool { return $this->required; } /** * @param bool|null $required * @return $this */ public function setRequired(?bool $required) { $this->required = $required; return $this; } /** * @return array|NULL */ public function getScope(): ?array { return $this->scope; } /** * Enable export/import in alternative scopes. * * @param string|array|null $scope * Ex: 'tplParams' * Ex: 'tplParams as foo_bar' * Ex: 'tplParams as contact_id, TokenProcessor as contactId' * Ex: ['tplParams' => 'foo_bar'] * @return $this */ public function setScope($scope) { if (is_array($scope)) { $this->scope = $scope; } else { $parts = explode(',', $scope); $this->scope = []; foreach ($parts as $part) { if (preg_match('/^\s*(\S+) as (\S+)\s*$/', $part, $m)) { $this->scope[trim($m[1])] = trim($m[2]); } else { $this->scope[trim($part)] = $this->getName(); } } } return $this; } }