Builds the code to be inserted directly in the event handling loop of the ManiaScript.
@return string The internal code.
325103
protected function buildInlineCode() {
        $result = '';
        if (!$this->events->isEmpty()) {
            $result .= '                case CMlEvent::Type::' . $this->getEventType() . ': {' . PHP_EOL;
            foreach ($this->events as $event) {
                $result .= $this->buildInlineCodeOfEvent($event);
            }
            $result .= '                }' . PHP_EOL;
        }
        return $result;
    }
1217663
public function build()
    {
        $definition = CodeDefinition::construct($this->tagName,
                                                $this->replacementText,
                                                $this->useOption,
                                                $this->parseContent,
                                                $this->nestLimit,
                                                $this->optionValidator,
                                                $this->bodyValidator);
        return $definition;
    }
261062
protected function getInlineJavaScript()
    {
        $resizeable = $this->resizeable ? 'true' : 'false';
        return sprintf(
            "var %s_obj = new SwatTextarea('%s', %s);",
            $this->id,
            $this->id,
            $resizeable
        );
    }
609299
public function getRendererInlineJavaScript()
    {
        $javascript = '';

        foreach ($this->getRenderers() as $renderer) {
            $renderer_javascript = $renderer->getInlineJavaScript();
            if ($renderer_javascript != '') {
                $javascript = "\n" . $renderer_javascript;
            }
        }

        return $javascript;
    }
820535
protected function buildEventLoop() {
        $eventLoop = $this->eventHandlerFactory->getHandler('Loop')->getInlineCode()
            . $this->buildControlHandlerLoop()
            . $this->eventHandlerFactory->getHandler('Custom')->getInlineCode()
            . $this->eventHandlerFactory->getHandler('Timer')->getInlineCode();

        $result = '';
        if (!empty($eventLoop)) {
            $result = '    while(True) {' . PHP_EOL
                    . $eventLoop
                    . '        yield;' . PHP_EOL
                    . '    }';
        }
        return $result;
    }
1084781
public function getScript() {
		$this->jquery_code_for_compile=array ();
		foreach ( $this->jsCodes as $jsCode ) {
			$this->jquery_code_for_compile []=$jsCode->compile(array (
					"identifier" => $this->attachTo
			));
		}
		$this->compileEvents();
		return $this->compileJQueryCode();
	}
986201
public function generate()
    {
        $indentation = $this->getIndentation();

        $code = array();
        foreach ($this->tags as $tag) {
            $code[] = $indentation . ' * ' . trim($tag->generate());
        }

        return implode($this->getLineFeed(), $code);
    }
982362
protected function getInlineJavaScript()
    {
        static $shown = false;

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

        $javascript .= sprintf(
            "var %s = new %s(\n" . "%s, %s, %s, %s, %s, %s);\n",
            $this->id,
            $this->getJavaScriptClass(),
            SwatString::quoteJavaScriptString($this->id),
            SwatString::quoteJavaScriptString($this->preview_image),
            intval($this->preview_width),
            intval($this->preview_height),
            $this->show_title ? 'true' : 'false',
            SwatString::quoteJavaScriptString($this->preview_title)
        );

        if ($this->container_width !== null) {
            $javascript .= sprintf(
                "%s.width = %s;",
                $this->id,
                (int) $this->container_width
            );
        }

        if ($this->container_height !== null) {
            $javascript .= sprintf(
                "%s.height = %s;",
                $this->id,
                (int) $this->container_height
            );
        }

        return $javascript;
    }
362426
protected function getInlineJavaScript()
    {
        $javascript = sprintf(
            "var %s = new SwatTileView('%s');",
            $this->id,
            $this->id
        );

        if ($this->tile !== null) {
            $tile_javascript = $this->tile->getRendererInlineJavaScript();
            if ($tile_javascript != '') {
                $javascript .= $tile_javascript;
            }

            $tile_javascript = $this->tile->getInlineJavaScript();
            if ($tile_javascript != '') {
                $javascript .= "\n" . $tile_javascript;
            }
        }

        if ($this->showCheckAll()) {
            $check_all = $this->getCompositeWidget('check_all');

            $renderer = $this->getCheckboxCellRenderer();
            $javascript .= "\n" . $check_all->getInlineJavascript();

            // set the controller of the check-all widget
            $javascript .= sprintf(
                "\n%s_obj.setController(%s);",
                $check_all->id,
                $renderer->id
            );
        }

        return $javascript;
    }
1076043
public function buildScript()
	{
		$options	= array(
			'url'		=> $this->url,
			'async'		=> $this->async,
			'cache'		=> $this->cache,
			'data'		=> $this->data,
			'selected'	=> $this->selected
		);
		return UI_HTML_JQuery::buildPluginCall( 'ajaxOptions', "select[name='".$this->name."']", $options );
	}
1318922
function compile() {
		$code = $this->match_code($this->value) ;

		$id = $this->varid() ;

		if ( $this->optional ) {
			$code = PHPBuilder::build()
				->l(
				$this->save($id),
				$code->replace( array( 'FAIL' => $this->restore($id,true) ))
				);
		}

		if ( $this->zero_or_more ) {
			$code = PHPBuilder::build()
				->b( 'while (true)',
					$this->save($id),
					$code->replace( array(
						'MATCH' => NULL,
						'FAIL' =>
							$this->restore($id,true)
							->l( 'break;' )
					))
				)
				->l(
				'MATCH'
				);
		}

		if ( $this->one_or_more ) {
			$code = PHPBuilder::build()
				->l(
				'$count = 0;'
				)
				->b( 'while (true)',
					$this->save($id),
					$code->replace( array(
						'MATCH' => NULL,
						'FAIL' =>
							$this->restore($id,true)
							->l( 'break;' )
					)),
					'$count += 1;'
				)
				->b( 'if ($count > 0)', 'MATCH' )
				->b( 'else',            'FAIL' );
		}

		if ( $this->positive_lookahead ) {
			$code = PHPBuilder::build()
				->l(
				$this->save($id),
				$code->replace( array(
					'MATCH' =>
						$this->restore($id)
						->l( 'MATCH' ),
					'FAIL' =>
						$this->restore($id)
						->l( 'FAIL' )
				)));
		}

		if ( $this->negative_lookahead ) {
			$code = PHPBuilder::build()
				->l(
				$this->save($id),
				$code->replace( array(
					'MATCH' =>
						$this->restore($id)
						->l( 'FAIL' ),
					'FAIL' =>
						$this->restore($id)
						->l( 'MATCH' )
				)));
		}

		if ( $this->tag && !($this instanceof TokenRecurse ) ) {
			$code = PHPBuilder::build()
				->l(
				'$stack[] = $result; $result = $this->construct( $matchrule, "'.$this->tag.'" ); ',
				$code->replace(array(
					'MATCH' => PHPBuilder::build()
						->l(
						'$subres = $result; $result = array_pop($stack);',
						'$this->store( $result, $subres, \''.$this->tag.'\' );',
						'MATCH'
						),
					'FAIL' => PHPBuilder::build()
						->l(
						'$result = array_pop($stack);',
						'FAIL'
						)
				)));
		}

		return $code ;
	}
985494
private function generate_code()
    {
        $length = rand($this->min_length, $this->max_length);
        $numChars = strlen($this->chars);

        $str = [];
        for ($i = 0; $i < $length; $i++) {
            $str[] = substr($this->chars, rand(1, $numChars) - 1, 1);
        }
        $str = implode('', $str);

        // Mix string
        $array_mix = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
        srand(microtime(true));
        shuffle($array_mix);

        return implode('', $array_mix);
    }
183103
public function compileContainerCode()
    {
        $builder = new ContainerBuilder($this->configTree);
        foreach ($this->plugins as $name => $plugin) {
            $plugin->setContainerBuilder($builder);
        }
        $containerNode = $builder->build();
        $buffer = new Buffer();
        $buffer->write('<?php')->eol();
        $containerNode->compile($buffer);
        $buffer->writeln('return $z;');
        $code = $buffer->getResult();
        return $code;
    }
475133
public function getCode(): string
  {
    $lines       = [];
    $indentLevel = 0;

    foreach ($this->lines as $line)
    {
      $mode = $this->indentationMode($line);

      // Increment or decrement indentation level.
      if ($mode & self::C_INDENT_INCREMENT_BEFORE)
      {
        $indentLevel++;
      }
      if ($mode & self::C_INDENT_DECREMENT_BEFORE)
      {
        $indentLevel = max(0, $indentLevel - 1);
      }
      if ($mode & self::C_INDENT_DECREMENT_BEFORE_DOUBLE)
      {
        $indentLevel = max(0, $indentLevel - 2);
      }

      // If the line is a separator shorten the separator.
      if ($this->separator!==null && $line==$this->separator)
      {
        $line = $this->shortenSeparator($this->width - $this->indentation * $indentLevel);
      }

      // Append the line with indentation.
      $lines[] = $this->addIndentation($line, $indentLevel);

      // Increment or decrement indentation level.
      if ($mode & self::C_INDENT_INCREMENT_AFTER)
      {
        $indentLevel++;
      }
      if ($mode & self::C_INDENT_DECREMENT_AFTER)
      {
        $indentLevel = max(0, $indentLevel - 1);
      }
    }

    if (empty($lines))
    {
      return '';
    }

    return implode(PHP_EOL, $lines).PHP_EOL;
  }
369469
protected function getInlineJavaScript()
    {
        $javascript = sprintf(
            "var %1\$s_obj = new %2\$s('%1\$s', %3\$s);",
            $this->id,
            $this->getJavascriptClassName(),
            $this->animate ? 'true' : 'false'
        );

        $javascript .= sprintf(
            "\n%s_obj.animate = %s;",
            $this->id,
            $this->animate ? 'true' : 'false'
        );

        $javascript .= sprintf(
            "\n%s_obj.always_open = %s;",
            $this->id,
            $this->always_open ? 'true' : 'false'
        );

        return $javascript;
    }
326754
public function ___build(): string
    {
        $this->escapeClass->doNotEscape($this->namesClass->getAliases());

        $tables = \implode(', ', $this->into);
        $fields = \implode(',', \array_keys($this->fields));
        $values = \implode(',', \array_map([$this->escapeClass, 'escape'], \array_values($this->fields)));

        return \sprintf('INSERT INTO %s (%s) VALUES (%s)', $tables, $fields, $values);
    }
65484
public function toStringCode()
    {
        if (!$this->isInterface() && !$this->isAbstract()) {
            $tabulationFormatted = $this->getTabulationFormatted();
            $code = PHP_EOL . $tabulationFormatted
                . '{'
                . $this->codeToString()
                . $tabulationFormatted
                . '}';

            return $code;
        }

        return ';';
    }