/*!
Returns an array with hints for the template compiler.
429719
function functionTemplateHints()
    {
        return array(
            $this->LName => array( 'parameters' => false, 'static' => false, 'tree-transformation' => true ),
            $this->RName => array( 'parameters' => false, 'static' => false, 'tree-transformation' => true )
        );
    }
249074
public function getSymbols(): iterable
    {
        return new \CallbackFilterIterator(
            new \RecursiveIteratorIterator(
                new \RecursiveArrayIterator($this->symbols, \RecursiveArrayIterator::CHILD_ARRAYS_ONLY)
            ),
            function ($each): bool {
                return $each !== false;
            }
        );
    }
906452
public function getTemplatesArray()
    {
        $templates = $this->getTemplates();

        foreach ($templates as $template) {
            $templates_array[$template->name] = $this->crud->makeLabel($template->name);
        }

        return $templates_array;
    }
62450
private function getCustomElements(){
        $customElements = array();
        foreach($this->qtiItem->getComposingElements() as $element){
            if($element instanceof PortableCustomInteraction){
                $customElements[] = $element;
            }
        }
        return $customElements;
    }
1211203
private function getElementsToProcess(): array
    {
        $result = [];

        foreach (get_object_vars($this) as $element) {
            if ($element instanceof FormElementInterface) {
                $result[] = $element;
            }
        }

        $result = array_merge($result, $this->extraElements);

        return $result;
    }
768623
private function getType(): array
    {
        if (!$this->type || $this->is('customize_preview')) {
            $this->type = parent::type();
        }

        return $this->type;
    }
289111
function procesArray(array) {
  if (!array || !Array.isArray(array)) {
    return array;
  }
  return array.map((item, index) => {
    if (typeof item === "string") {
      return localizeString(item);
    }
    return item;
  });
}
423376
public static function getArray($var)
    {
        if (is_null($var) || empty($var)) {
            return [];
        }

        foreach ($var as $value) {
            if ((gettype($value) == 'object')
                && (get_class($value) == 'SimpleXMLElement')
            ) {
                return (array) $var;
            } elseif (!is_array($value)) {
                return [$var];
            }
        }

        return $var;
    }
1039407
private function _getTemplateList()
    {
        $dirlist = CommonFunctions::gdc(PSI_APP_ROOT.'/templates/');
        sort($dirlist);
        foreach ($dirlist as $file) {
            $tpl_ext = substr($file, strlen($file) - 4);
            $tpl_name = substr($file, 0, strlen($file) - 4);
            if ($tpl_ext === ".css") {
                if (preg_match("/(\S+)_bootstrap$/", $tpl_name, $ar_buf)) {
                    array_push($this->_bootstrap_templates, $ar_buf[1]);
                } else {
                    array_push($this->_templates, $tpl_name);
                }
            }
        }
    }
893889
protected function getAutoBindings(string $template)
    {
        if (is_null($this->variableProvider)) {
            return [];
        }

        $bindings = $this->variableProvider->provideVariables($template);

        return $bindings;
    }
1328868
function getNamedArray()
    {
        if ( isset( self::$injectedSettings[$this->FileName] ) )
        {
            return array_merge(
                $this->BlockValues,
                self::$injectedSettings[$this->FileName]
            );
        }
        return $this->BlockValues;
    }
684778
public function findAllTemplates()
    {
        if (null !== $this->templates) {
            return $this->templates;
        }

        $templates = array();

        foreach ($this->paths as $dir) {
            $templates = array_merge($templates, $this->findTemplatesInFolder($dir));
        }

        return $this->templates = $templates;
    }
499842
static function processElementTransformationChild( $useComments, $php, $tpl, &$node,
                                                $elementTree, $elementList, &$resourceData )
    {
        $count = is_countable( $elementList ) ? count( $elementList ) : 0;
        $lastElement = null;
        $newElementList = array();
        for ( $i = 0; $i < $count; ++$i )
        {
            $element =& $elementList[$i];
            $elementType = $element[0];
            if ( $elementType == eZTemplate::TYPE_OPERATOR )
            {
                $operatorName = $element[1][0];
                $operatorParameters = array_slice( $element[1], 1 );
                if ( !isset( $tpl->Operators[$operatorName] ) )
                    return false;

                if ( is_array( $tpl->Operators[$operatorName] ) )
                {
                    $tpl->loadAndRegisterOperators( $tpl->Operators[$operatorName] );
                }
                $operatorObject =& $tpl->Operators[$operatorName];
                if ( is_object( $operatorObject ) )
                {
                    $hasTransformationSupport = false;
                    $transformParameters = false;
                    $inputAsParameter = false;
                    $knownType = 'static';
                    if ( method_exists( $operatorObject, 'operatorTemplateHints' ) )
                    {
                        $hints = $operatorObject->operatorTemplateHints();
                        if ( isset( $hints[$operatorName] ) and
                             isset( $hints[$operatorName]['element-transformation'] ) and
                             $hints[$operatorName]['element-transformation'] )
                        {
                            $hasTransformationSupport = true;
                        }

                        if ( $hasTransformationSupport  and
                             isset( $hints[$operatorName]['element-transformation-func'] ) )
                        {
                            $transformationMethod = $hints[$operatorName]['element-transformation-func'];
                        }
                        else
                        {
                            $transformationMethod = 'templateElementTransformation';
                        }

                        if ( isset( $hints[$operatorName] ) and
                             isset( $hints[$operatorName]['transform-parameters'] ) )
                        {
                            $transformParameters = $hints[$operatorName]['transform-parameters'];
                        }

                        if ( isset( $hints[$operatorName] ) and
                             isset( $hints[$operatorName]['input-as-parameter'] ) )
                        {
                            $inputAsParameter = $hints[$operatorName]['input-as-parameter'];
                        }

                        if ( isset( $hints[$operatorName]['output'] ) and !$hints[$operatorName]['output'] )
                        {
                            $knownType = 'null';
                        }
                        else if ( isset( $hints[$operatorName]['output-type'] ) )
                        {
                            $knownType = $hints[$operatorName]['output-type'];
                        }
                    }
                    if ( $hasTransformationSupport and
                         method_exists( $operatorObject, $transformationMethod ) )
                    {
                        $resetNewElementList = false;
                        if ( $transformParameters )
                        {
                            $newParameters = array();
                            if ( $inputAsParameter )
                            {
                                $newParameterElements = eZTemplateCompiler::processElementTransformationChild( $useComments, $php, $tpl, $node,
                                                                                                               $elementTree, $newElementList, $resourceData );
                                if ( count( $newParameterElements ) > 0 or
                                     $inputAsParameter === 'always' )
                                {
                                    $newParameters[] = $newParameterElements;
                                    $resetNewElementList = true;
                                }
                            }

                            foreach ( $operatorParameters as $operatorParameter )
                            {
                                $newParameterElements = eZTemplateCompiler::processElementTransformationChild( $useComments, $php, $tpl, $node,
                                                                                                               $elementTree, $operatorParameter, $resourceData );
                                if ( !$newParameterElements )
                                    $newParameters[] = $operatorParameter;
                                else
                                    $newParameters[] = $newParameterElements;
                            }
                            $operatorParameters = $newParameters;
                        }

                        $newElements = $operatorObject->$transformationMethod( $operatorName, $node, $tpl, $resourceData,
                                                                               $element, $lastElement, $elementList, $elementTree,
                                                                               $operatorParameters );
                        if ( is_array( $newElements ) )
                        {
                            if ( $resetNewElementList )
                            {
                                $newElementList = $newElements;
                            }
                            else
                            {
                                $newElementList = array_merge( $newElementList, $newElements );
                            }
                        }
                        else
                        {
                            $newElementList[] = $element;
                        }
                    }
                    else
                    {
                        $newElementList[] = $element;
                    }
                }
                else if ( $resourceData['test-compile'] )
                {
                    $tpl->warning( '', "Operator '$operatorName' is not registered." );
                }
            }
            else
            {
                $newElementList[] = $element;
            }
            $lastElement = $element;
        }
        return $newElementList;
    }
1002729
function autocomplete_array(array &$hints = null) {
		if ($this->autocomplete === null) {
			$this->autocomplete = &$hints;
		}
		else if ($hints !== null) {
			foreach ($hints as $key => $hint) {
				$this->autocomplete[$key] = $hint;
			}
		}

		return $this;
	}
927999
public function formatTemplateFiles() : array
    {
        list(, $presenter) = \Nette\Application\Helpers::splitName($this->getName());
        $dir = dirname($this->getReflection()->getFileName());
        $dir = is_dir("{$dir}/templates") ? $dir : dirname($dir);
        return [
            "{$dir}/template/page/view/{$this->view}",
            "{$dir}/template/page/view/{$presenter}{$this->view}",
        ];
    }
1266894
function resourceData( $resourceObject, $uri, $resourceName, $templateName )
    {
        $resourceData = array();
        $resourceData['uri'] = $uri;
        $resourceData['resource'] = $resourceName;
        $resourceData['template-name'] = $templateName;
        $resourceData['template-filename'] = $templateName;
        $resourceData['handler'] = $resourceObject;
        $resourceData['test-compile'] = $this->TestCompile;
        return $resourceData;
    }
1096468
private function loadReturnsOfThisFunction(): array
    {
        $returnPositions = TokenHelper::findNextAll(
            $this->file->getBaseFile(),
            [T_RETURN],
            $this->stackPos + 1,
            $this->token['scope_closer']
        );

        return array_filter($returnPositions, function (int $returnPos): bool {
            $possibleClosure = $this->file->findPrevious([T_CLOSURE, T_FUNCTION], $returnPos - 1, $this->stackPos);

            return $possibleClosure === $this->stackPos;
        });
    }