[[@doctodo method_description:generate]].

@return [[@doctodo return_type:generate]] [[@doctodo return_description:generate]]
15078
public function generate()
    {
        $items = [];
        $this->htmlOptions['id'] = $this->id;
        $items[] = Html::beginTag('div', $this->htmlOptions);
        foreach ($this->_prepended as $item) {
            $items[] = $item->generate();
        }
        foreach ($this->_rows as $row) {
            $items[] = $row->generate();
        }
        foreach ($this->_appended as $item) {
            $items[] = $item->generate();
        }
        $items[] = Html::endTag('div');

        return implode('', $items);
    }
1118448
private function generateClass(): ServiceDTOGenerator
    {
        $this->DTOFile = (new PhpFile())
            ->addComment('This file is auto-generated.');

        $namespace = $this->inputData['namespace'] . '\\' . $this->inputData['module'] . 'Module\\' . $this->inputData['type'];

        $this->DTOClass = $this->DTOFile
            ->addNamespace($namespace)
            ->addClass($this->inputData['class'] . $this->inputData['type'])
            ->addComment($this->inputData['class'] . ' service ' . strtolower($this->inputData['type']) . PHP_EOL)
            ->addComment('@package ' . $namespace);

        return $this;
    }
29765
private function generateProperties(): EntityGenerator
    {
        $this->entityClass
            ->addProperty('id')
            ->setVisibility('private')
            ->addComment($this->entityData['class'] . ' ID' . PHP_EOL)
            ->addComment('@var int $id');

        foreach ($this->entityData['properties'] as $name => $type) {
            if ('datetime' === $type) {
                $type = '\DateTime';
            }

            $this->entityClass
                ->addProperty($name)
                ->setVisibility('private')
                ->addComment($this->entityData['class'] . ' ' . $name . PHP_EOL)
                ->addComment('@var ' . $type . ' $' . $name);
        }

        return $this;
    }
650912
private function generateMethods(): void
    {
        $this->printer->writeln('Generating methods.');
        $this->generator->setChildNamespace('Method');

        /** @var Method $method */
        foreach ($this->wsdl->getMethods() as $name => $method) {
            $this->printer->writeln(" |\-Generating method $name");
            $code = $method->visit($this->generator);
            $className = $this->findClassName($code);
            $filename = $this->destination . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';

            $this->writer->writeFile($filename, $code);
            $this->printer->writeln("  |- Wrote $className to $filename");
        }
    }
813951
public function generate()
    {
        $code = array();

        if ($this->namespace !== null) {
            $code[] = $this->getIndentation() . 'namespace ' . $this->namespace;
            $code[] = '{';
            $code[] = null;

            // Temporarily add one more level of indentation.
            $this->addIndentationLevel(1);
        }

        $code = array_merge($code, $this->renderUsesLines());

        $indentation = $this->getIndentation();

        $doc = $this->generateDocumentation();
        if ($doc !== null) {
            $code[] = $doc;
        }

        $line = $indentation;
        if ($this->isFinal() === true) {
            $line .= 'final ';
        } elseif ($this->isAbstract() === true) {
            $line .= 'abstract ';
        }

        $line .= 'class ' . $this->name;

        if ($this->extends !== null) {
            $line .= ' extends ' . $this->extends;
        }

        if (count($this->implements) > 0) {
            $line .= ' implements ' . implode(', ', $this->implements);
        }

        $code[] = $line;
        $code[] = $indentation . '{';

        // Class uses.
        $classElements = $this->generateTraitUsesLines();

        // Class constants.
        $classElements = array_merge($classElements, $this->generateConstantsLines());

        // Class properties.
        $classElements = array_merge($classElements, $this->generatePropertiesLines());

        // Class methods.
        $classElements = array_merge($classElements, $this->generateMethodsLines());

        if (count($classElements) > 0) {
            $code[] = null;
            $code = array_merge($code, $classElements);
            // Remove last empty line.
            array_pop($code);
        }

        $code[] = $indentation . '}';

        if ($this->namespace !== null) {
            // Set back the indentation.
            $this->addIndentationLevel(-1);

            $code[] = $this->getIndentation() . '}';
        }

        return implode($this->getLineFeed(), $code);
    }
337288
private function generateClasses()
    {
        foreach($this->ref->getClasses() as $class)
        {
            if($class->isInterface())
            {
                $this->generateInterface($class);
            }
            else if($class->isTrait())
            {
                $this->generateTrait($class);
            }
            else
            {
                $this->generateClass($class);
            }
        }
    }
910489
public function GenerateDescription()
    {
        if ($this->owner->MetaDescription) {
            return $this->owner->MetaDescription;
        } else {
            return $this->owner->GenerateDescriptionFromContent();
        }
    }
357577
public function generate()
    {
        $files = [];
        $relations = $this->generateRelations();
        $db = $this->getDbConnection();
        foreach ($this->getTableNames() as $tableName) {
            // model :
            $modelClassName = $this->generateClassName($tableName);
            $queryClassName = ($this->generateQuery) ? $this->generateQueryClassName($modelClassName) : false;
            $searchClassName = ($this->generateQuery) ? $this->generateSearchClassName($modelClassName) : false;
            $tableSchema = $db->getTableSchema($tableName);
            $params = [
                'tableName' => $tableName,
                'className' => $modelClassName,
                'queryClassName' => $queryClassName,
                'tableSchema' => $tableSchema,
                'labels' => $this->generateLabels($tableSchema),
                'rules' => $this->generateRules($tableSchema, false, false),
                'filterRules' => $this->generateRules($tableSchema, false, true),
                'relations' => isset($relations[$tableName]) ? $relations[$tableName] : [],
                'behaviors' => $this->generateBehaviors($tableSchema),
            ];
            $files[] = new CodeFile(
                Yii::getAlias('@' . str_replace('\\', '/', $this->ns)) . '/' . $modelClassName . '.php',
                $this->render('model.php', $params)
            );

            if ($queryClassName) {
                $params = [
                    'className' => $queryClassName,
                    'modelClassName' => $modelClassName,
                ];
                $files[] = new CodeFile(
                    Yii::getAlias('@' . str_replace('\\', '/', $this->queryNs)) . '/' . $queryClassName . '.php',
                    $this->render('query.php', $params)
                );
            }

            if ($searchClassName) {
                $params = [
                    'className' => $searchClassName,
                    'modelClassName' => $modelClassName,
                    'queryClassName' => $queryClassName ? $queryClassName : 'ActiveQuery',
                    'labels' => $this->generateLabels($tableSchema),
                    'rules' => $this->generateRules($tableSchema, true, false),
                    'filterRules' => $this->generateRules($tableSchema, true, true),
                    'relations' => isset($relations[$tableName]) ? $relations[$tableName] : [],
                ];
                $files[] = new CodeFile(
                    Yii::getAlias('@' . str_replace('\\', '/', $this->searchNs)) . '/' . $searchClassName . '.php',
                    $this->render('search.php', $params)
                );
            }
        }

        return $files;
    }
1002886
public function generate()
	{
		if (TL_MODE == 'BE')
		{
			$objTemplate = new \BackendTemplate('be_wildcard');
			$objTemplate->wildcard = '### VISITORS LIST ###';
			$objTemplate->title = $this->headline;
            $objTemplate->id = $this->id;
            $objTemplate->link = $this->name;
            $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
		
			return $objTemplate->parse();
		}
		//alte und neue Art gemeinsam zum Array bringen
		if (strpos($this->visitors_categories,':') !== false) 
		{
			$this->visitors_categories = deserialize($this->visitors_categories, true);
		} 
		else 
		{
			$this->visitors_categories = array($this->visitors_categories);
		}
		// Return if there are no categories
		if (!is_array($this->visitors_categories) || !is_numeric($this->visitors_categories[0]))
		{
			return '';
		}
		$this->useragent_filter = $this->visitors_useragent;
		return parent::generate();
	}
869604
public function generate()
	{
		$html = array();

		foreach ($this->properties as $property => $value):
			if (is_array($value)):
				foreach ($value as $_value) {
					$html[] = strtr(
						static::OPENGRAPH_TAG,
						array(
							'[property]' => static::OPENGRAPH_PREFIX . $property,
							'[value]'    => $_value
						)
					);
				}
			else:
				$html[] = strtr(
					static::OPENGRAPH_TAG,
					array(
						'[property]' => static::OPENGRAPH_PREFIX . $property,
						'[value]'    => $value
					)
				);
			endif;
		endforeach;

		return implode(PHP_EOL, $html);
	}
1324358
protected function generateNodeTypeDefinitions()
    {
        $code = '';
        /** @var NodeType $nodeType */
        foreach ($this->nodeTypeManager->getNodeTypes(false) as $nodeType) {
            $code .= $this->generateFusionForNodeType($nodeType);
        }
        return $code;
    }
708819
public function generate()
	{
		$args = func_get_args();
		$useKeyLength = array_shift($args);

		if (!is_bool($useKeyLength)) {
			array_unshift($args, $useKeyLength);
			$useKeyLength = false;
		}

		$callables = call_user_func_array(array($this, 'flattenArguments'), $args);

		$key = $this->keygen($useKeyLength ? $this->length : $this->getAdjustedKeyLength());

		while ($callable = current($callables)) {
			if (is_callable($callable)) {
				$key = call_user_func($callable, $key);
			}
			next($callables);
		}

		return sprintf("%s%s%s", $this->prefix, $key, $this->suffix);
	}
1146098
public function generate()
    {
        $indentation = $this->getIndentation();

        $docLines = array();

        $docLines[] = $indentation . '/**';
        $spaceBeforeAnnotation = false;

        if ($this->shortDescription !== null) {
            $docLines[] = $indentation . ' * ' . $this->shortDescription;
            $spaceBeforeAnnotation = true;
        }

        if ($this->shortDescription !== null && $this->longDescription !== null) {
            $docLines[] = $indentation . ' *';
        }

        if ($this->longDescription !== null) {
            $description = preg_split('/\n|\r/', $this->longDescription, -1, PREG_SPLIT_NO_EMPTY);
            foreach ($description as $desc) {
                $docLines[] = $indentation . ' * ' . trim($desc);
            }

            $spaceBeforeAnnotation = true;
        }

        $this->annotationGenerator->setIndentationLevel($this->getIndentationLevel());
        $this->annotationGenerator->setIndentationString($this->getIndentationString());
        $annotations = $this->annotationGenerator->generate();
        if ($annotations !== '') {
            if ($spaceBeforeAnnotation === true) {
                $docLines[] = $indentation . ' *';
            }

            $docLines[] = $annotations;
        }

        $docLines[] = $indentation . ' */';

        return implode($this->getLineFeed(), $docLines);
    }
110761
public function generate() {

		$methods   = array(); // Actual validation methods
		$rules     = array(); // Individual field rules
		$messages  = array(); // Field error messages
		$php_rules = $this->validator->get_rules();


		foreach($php_rules as $field_name => $field_rules) {

			$rules[$field_name] = array();

			foreach($field_rules as $rule) {

				if( ! ($rule instanceof jQueryValidationRule) ) continue;
				$rule_name = $rule->jquery__get_rule_name();


				if(!isset($methods[$rule_name])) {
					$method = method_exists($rule, 'jquery__get_method_definition') ? $rule->jquery__get_method_definition() : null;
					if($method) $methods[$rule_name] = $method;
				}


				$js_rule = $rule->jquery__get_rule_definition();

				if(is_array($js_rule)) {
					$rules[$field_name] = array_merge($rules[$field_name], $js_rule);
				} else {
					$rules[$field_name][$js_rule] = true;
				}


				$messages[$field_name][$rule_name] = $rule->get_error_message($field_name, null, $this->validator);

			}

			if(empty($rules[$field_name])) unset($rules[$field_name]);
			if(empty($messages[$field_name])) unset($messages[$field_name]);

		}


		return array(
			'rules'    => $rules,
			'messages' => $messages,
			'methods'  => $methods,
		);

	}
244830
public static function generate()
    {
        $oDb              = Factory::service('PDODatabase');
        $oSettingsService = Factory::service('AppSetting');
        $oModel           = Factory::model('Blog', 'nails/module-blog');
        $aRoutes          = [];

        $oRows = $oDb->query('SELECT id FROM ' . $oModel->getTableName());
        if (!$oRows->rowCount()) {
            return [];
        }

        while ($oRow = $oRows->fetch(\PDO::FETCH_OBJ)) {

            //  Look up the setting
            $oSettings = $oDb->query('
              SELECT * FROM ' . $oSettingsService->getTableName() . '
              WHERE `grouping` = "blog-' . $oRow->id . '"
              AND `key` = "url"

            ');

            $sUrl = json_decode($oSettings->fetch(\PDO::FETCH_OBJ)->value) ?: 'blog';
            $sUrl = preg_replace('/^\//', '', $sUrl);
            $sUrl = preg_replace('/\/$/', '', $sUrl);

            $aRoutes[$sUrl . '(/(.+))?'] = 'blog/' . $oRow->id . '/$2';
        }

        return $aRoutes;
    }
572649
public function generate()
    {
        $code = array();

        if ($this->namespace !== null) {
            $code[] = $this->getIndentation() . 'namespace ' . $this->namespace;
            $code[] = '{';
            $code[] = null;

            // Temporarily add one more level of indentation.
            $this->addIndentationLevel(1);
        }

        $code = array_merge($code, $this->renderUsesLines());

        $indentation = $this->getIndentation();

        $doc = $this->generateDocumentation();
        if ($doc !== null) {
            $code[] = $doc;
        }

        $line = $indentation . 'interface ' . $this->name;
        if (count($this->extends) > 0) {
            $line .= ' extends ' . implode(', ', $this->extends);
        }

        $code[] = $line;
        $code[] = $indentation . '{';

        // Interface constants.
        $interfaceElements = $this->generateConstantsLines();

        // Interface methods.
        foreach ($this->methods as $method) {
            if ($method->getVisibility() !== Modifiers::VISIBILITY_PUBLIC) {
                throw new RuntimeException('The visibility of methods must be public.');
            }

            $method->setIndentationString($this->getIndentationString());
            $method->setIndentationLevel($this->getIndentationLevel() + 1);

            $doc = $method->generateDocumentation();
            if ($doc !== null) {
                $interfaceElements[] = $doc;
            }

            $interfaceElements[] = $method->generateSignature() . ';';
            $interfaceElements[] = null;
        }

        if (count($interfaceElements) > 0) {
            $code[] = null;
            $code = array_merge($code, $interfaceElements);
            // Remove last empty line.
            array_pop($code);
        }

        $code[] = $indentation . '}';

        if ($this->namespace !== null) {
            // Set back the indentation.
            $this->addIndentationLevel(-1);

            $code[] = $this->getIndentation() . '}';
        }

        return implode($this->getLineFeed(), $code);
    }
323099
def _generate(self):
        """"""
        doc_count = 0
        for fp in self.all_files:
            for doc in self._get_docs_for_path(fp):
                yield doc
                doc_count += 1
                if doc_count >= self.max_docs:
                    return