If debug is active we should separate each JS function to prevent one
wrong code to brake all others

@return string
196159
public function makeAddDebug(){
		$s = "";
		foreach ($this->headers as $code){
			$s .= '$( document ).ready(function() {'."\n";
			$s .= $code;
			$s .= "\n});\n\n";
		}
		return $s;
	}
158607
public static function args()
    {
        if (!self::isDebug()) {
            return false;
        }

        $_this = self::i();

        $trace        = debug_backtrace(0);
        $currentTrace = $trace[1];
        if (isset($currentTrace['args'])) {

            // get function info (class method or simple func)
            if (isset($currentTrace['class'])) {

                $classInfo = $_this->_getClass($currentTrace['class']);
                if (isset($classInfo['methods']['public'][$currentTrace['function']])) {
                    $funcInfo = $classInfo['methods']['public'][$currentTrace['function']];

                } elseif (isset($classInfo['methods']['private'][$currentTrace['function']])) {
                    $funcInfo = $classInfo['methods']['private'][$currentTrace['function']];

                } elseif (isset($classInfo['methods']['protected'][$currentTrace['function']])) {
                    $funcInfo = $classInfo['methods']['protected'][$currentTrace['function']];
                }

            } else {
                $funcInfo = $_this->_getFunction($currentTrace['function']);
            }

            // chech arguments info
            if (isset($funcInfo['parameters'])) {
                $result = array();
                $i      = 0;
                foreach ($funcInfo['parameters'] as $argName => $argInfo) {

                    if (isset($currentTrace['args'][$i])) {
                        $result[$argName] = $currentTrace['args'][$i];

                    } elseif (isset($argInfo['default'])) {
                        $result[$argName] = $argInfo['default'];

                    } else {
                        $result[$argName] = null;
                    }

                    $i++;
                }

            } else {
                $result = $currentTrace['args'];
            }

            $_this->dump($result);
        }

        return $_this;
    }
1030685
public function getCallbackCode()
    {
        $reflection = new \ReflectionFunction($this->_callback);
        
        // Open file and seek to the first line of the closure
        $file = new \SplFileObject($reflection->getFileName());
        $file->seek($reflection->getStartLine() - 1);

        // Retrieve all of the lines that contain code for the closure
        $code = '';
        while ($file->key() < $reflection->getEndLine())
        {
            $code .= $file->current();
            $file->next();
        }

        $begin = strpos($code, 'function');
        $end = strrpos($code, '}');
        $code = substr($code, $begin, $end - $begin + 1);

        return $code;
    }
763008
private function getTrace()
    {
        $trace = array();

        if (PHP_VERSION_ID >= 50400) {
            $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10);
        } else if (PHP_VERSION_ID >= 50306) {
            $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
        } else {
            $trace = debug_backtrace();
        }
        if (empty($trace)) {
            return '';
        }
        array_shift($trace); // ignore $this->getTrace();
        array_shift($trace); // ignore $this->process()
        $i = 0;
        $returnArray = array();
        while (isset($trace[$i]['class']) && false === strpos($trace[$i]['class'], 'Zend\\Log')
            && false === strpos($trace[$i]['class'], 'DhErrorLogging')) {
            $i++;
            $returnArray[] = array(
                'file'     => isset($trace[$i]['file'])   ? $trace[$i]['file']   : null,
                'line'     => isset($trace[$i]['line'])   ? $trace[$i]['line']   : null,
                'class'    => isset($trace[$i]['class'])    ? $trace[$i]['class']    : null,
                'function' => isset($trace[$i]['function']) ? $trace[$i]['function'] : null,
            );
        }

        return $returnArray;
    }
659736
public function getScript()
    {
        $di = jaxon()->di();
        $code = '';
        foreach(array_keys($this->aFunctions) as $sName)
        {
            $xFunction = $di->get($sName);
            $code .= $xFunction->getScript();
        }
        return $code;
    }
938773
protected function getInlineJavaScript()
    {
        $javascript = sprintf(
            'var %s_obj = new %s(%s);',
            $this->id,
            $this->getJavaScriptClassName(),
            SwatString::quoteJavaScriptString($this->id)
        );

        // set check-all controller if it is visible
        $check_all = $this->getCompositeWidget('check_all');
        if ($check_all->visible) {
            $javascript .= sprintf(
                "\n%s_obj.setController(%s_obj);",
                $check_all->id,
                $this->id
            );
        }

        return $javascript;
    }
1060203
protected function getInlineJavaScript()
    {
        $javascript = '';

        foreach ($this->fields as $field) {
            $field_javascript = $field->getRendererInlineJavaScript();
            if ($field_javascript != '') {
                $javascript .= "\n" . $field_javascript;
            }
        }

        foreach ($this->fields as $field) {
            $field_javascript = $field->getInlineJavaScript();
            if ($field_javascript != '') {
                $javascript .= "\n" . $field_javascript;
            }
        }

        return $javascript;
    }
886800
static function checkDebugByUser()
    {
        if ( !isset( $GLOBALS['eZDebugUserIDList'] ) ||
             !is_array( $GLOBALS['eZDebugUserIDList'] ) )
        {
            return false;
        }
        else
        {
            $currentUserID = eZUser::currentUserID();

            if ( !$currentUserID )
            {
                return false;
            }
            else
            {
                $GLOBALS['eZDebugAllowedByUser'] = in_array( $currentUserID, $GLOBALS['eZDebugUserIDList'] );

                if ( $GLOBALS['eZDebugAllowed'] )
                {
                    $GLOBALS['eZDebugAllowed'] = $GLOBALS['eZDebugAllowedByUser'];
                }

                if ( $GLOBALS['eZDebugEnabled'] )
                {
                    $GLOBALS['eZDebugEnabled'] = $GLOBALS['eZDebugAllowedByUser'];
                }

                unset( $GLOBALS['eZDebugUserIDList'] );

                return true;
            }
        }
    }
917267
public function getJsCode()
    {
        $html = '';
        foreach ($this->js as $js) {
            $html .= sprintf('<script src="%s"></script>', $js);
        }
        foreach ($this->entry as $entry) {
            $html .= sprintf('<script>System.import(\'%s\')</script>', $entry);
        }
        return $html;
    }
549368
public function getInlineJavaScript()
    {
        if (count($this->view->model) < 2) {
            return '';
        }

        // set the controller of the check-all widget
        return sprintf(
            "%s_obj.setController(%s);",
            $this->check_all->id,
            $this->list_id
        );
    }
750227
public function renderDebug()
    {
        $html = '';
        foreach (static::DEBUG_ELEMENTS as $element) {
            $html .= $this->consoleLog('"Checking element binding of ' . $element . '..."');
            $html .= $this->consoleLog($element . '!==undefined');
        }

        return $html;
    }
282811
public function getFieldsActivationJavaScriptCode()
    {
        $javaScriptBlocks = [];
        $formConfiguration = $this->getFormObject()->getConfiguration();

        foreach ($formConfiguration->getFields() as $field) {
            $fieldConditionExpression = [];
            $javaScriptTree = $this->getConditionTreeForField($field)->getJavaScriptConditions();

            if (false === empty($javaScriptTree)) {
                foreach ($javaScriptTree as $node) {
                    $fieldConditionExpression[] = 'flag = flag || (' . $node . ');';
                }

                $javaScriptBlocks[] = $this->getSingleFieldActivationConditionFunction($field, $fieldConditionExpression);
            }
        }

        $javaScriptBlocks = implode(CRLF, $javaScriptBlocks);
        $formName = GeneralUtility::quoteJSvalue($this->getFormObject()->getName());

        return <<<JS
(function() {
    Fz.Form.get(
        $formName,
        function(form) {
            var field = null;

$javaScriptBlocks
        }
    );
})();
JS;
    }
812028
public function ___debugInfo()
    {
        return array(
            'name'  => isset($this->propertyNode) ? $this->propertyNode->name->toString() : 'unknown',
            'class' => $this->className
        );
    }
1229296
public static function output()
    {

        $aArgs = func_get_args();
        $iArgs = func_num_args();

        $c = $aArgs[0];

        if(isset($GLOBALS[self::$pref.$c])){
            switch (true) {
                case ($c == 'js'):

                    $output = Asset::dump($GLOBALS[self::$pref.$c]);

                    break;
                case ($c == 'css'):
                    $output = Asset::dump($GLOBALS[self::$pref.$c]);
                    break;
                default:
                    $output = $GLOBALS[self::$pref.$c];
                    break;
            }
        } else {
            $output = false;
        }



        return $output;
    }
357921
protected function getInlineJavaScript()
    {
        static $shown = false;

        if (!$shown) {
            $javascript = $this->getInlineJavaScriptTranslations();
            $shown = true;
        } else {
            $javascript = '';
        }

        $dismissable_messages =
            '[' . implode(', ', $this->dismissable_messages) . ']';

        $javascript .= sprintf(
            "var %s_obj = new %s('%s', %s);",
            $this->id,
            $this->getJavaScriptClass(),
            $this->id,
            $dismissable_messages
        );

        return $javascript;
    }
755473
function error() {
        if ($this->error) {
            //Put some template variables for debugging here ...
            $debug_tpl_vars = array(
                '{LANGUAGE}' => $this->language,
                '{PATH}' => $this->language_path
            );
            $msg = str_replace(
                array_keys($debug_tpl_vars),
                array_values($debug_tpl_vars),
                $this->error_messages[$this->error]);

            return "<br /><strong>GeSHi Error:</strong> $msg (code {$this->error})<br />";
        }
        return false;
    }
1272441
public function jsRender()
    {
        $pre = '';

        if ($this->preventDefault) {
            $this->fx_args = ['event'];
            $pre .= "\n".$this->indent.'  event.preventDefault();';
        }

        if ($this->stopPropagation) {
            $this->fx_args = ['event'];
            $pre .= "\n".$this->indent.'  event.stopPropagation();';
        }

        $output = 'function('.implode(',', $this->fx_args).') {';
        $output .= $pre;
        foreach ($this->fx_statements as $statement) {
            if (!$statement) {
                // null passed
                continue;
            }

            if ($statement instanceof jsChain && !$statement->_chain) {
                // chain contains no statements, so probably is useless
                continue;
            }

            if ($statement instanceof jsExpressionable) {
                $statement = $statement->jsRender();
            } else {
                throw new Exception(['Incorrect statement for jsFunction.', 'statement' => $statement]);
            }

            $output .= "\n".$this->indent.'  '.$statement.';';
        }

        $output .= "\n".$this->indent.'}';

        return $output;
    }