生成
@author nash.tang <112614251@qq.com>
1641
public function run()
    {
        if(Schema::hasTable(strtolower($this->model)))
        {
            $tableName = strtolower($this->model);
        }elseif(Schema::hasTable(strtolower($this->model)."s")) {
            $tableName = strtolower($this->model."s");
        }else{
            $tableName = "";
        }

        $module  = camel_case($this->module);
        $model   = camel_case($this->model);

        $templatePath = $this->customTemplate ?: __DIR__."/template/model.blade.php";

        $view =  View::file($templatePath, [
            "group"         => $this->group,
            "module"        => $module,
            "model"         => $model,
            "tableName"     => $tableName,
            "primaryKey"    => "id"
        ]);

        $filePath = "Models/".ucfirst($model).".php";

        if(!is_dir(app_path("Models/")))
        {
            mkdir(app_path("Models/"));
        }

        if(!file_exists(app_path($filePath)))
        {
            file_put_contents(app_path($filePath), "<?php \n\n" . $view->render());
        }else{
            if($this->mode == "overwrite")
            {
                file_put_contents(app_path($filePath), "<?php \n\n" . $view->render());
            }
        }
    }
1229523
public function generate()
	{
		$title         = $this->getTitle();
		$description   = $this->getDescription();
		$keywords      = $this->getKeywords();
		$miscellaneous = $this->getMiscellaneous();
		$canonical     = $this->getCanonical();

		$html[] = '<title>'.$title.'</title>'.PHP_EOL;

		if (! is_null($description)) {
			$html[] = '<meta name="description" content="'.$description.'">';
		}

		if (! is_null($keywords)) {
			$html[] = '<meta name="keywords" content="'.$keywords.'">';
		}

		if (! is_null($miscellaneous)) {
			foreach ($miscellaneous as $name => $content) {
				$html[] = '<meta name="'.$name.'" content="'.$content.'">';
			}
		}

		if (! is_null($canonical)) {
			$currentUrl = $this->request->fullUrl();

			if ($canonical != $currentUrl) {
				$html[] = PHP_EOL.'<link rel="canonical" href="'.$canonical.'">';
			}
		}

		return implode(PHP_EOL, $html);
	}
225846
function createXml()
  {
    $this->parameters["appid"] = $this->appId;//公众账号ID
    $this->parameters["mch_id"] = $this->MCHID;//商户号
    $this->parameters["nonce_str"] = $this->weObj->generateNonceStr();//随机字符串
    $this->parameters["sign"] = $this->getSign($this->parameters);//签名
    return  $this->arrayToXml($this->parameters);
  }
1172601
public function generate()
    {
        if ($this->parentIdentifier && !$this->parentObj) {
            $this->determineParentObj();
        }


        $i = 0;
        $ids = array();
        $parentField = $this->parentField;
        while ($i < $this->count) {
            $obj = Injector::inst()->create($this->subjectClass);
            if ($this->parentObj) {
                $obj->$parentField = $this->parentObj->ID;
            }
            $obj->fill(array(
                'only_empty' => $this->onlyEmpty,
                'include_relations' => $this->includeRelations,
                'download_images' => $this->downloadImages,
                'relation_create_limit' => $this->relationCreateLimit
            ));
            if ($this->parentObj) {
                $obj->write();
            }
            if ($this->isSiteTree) {
                $ids[] = $obj->write();
                $obj->publish("Stage", "Live");
            }
            $this->log("Created {$this->subjectClass} \"{$obj->getTitle()}\".");
            $i++;
        }

        return $ids;
    }
876895
public function generate()
    {
        // Add empty option (XHTML) if there are none
        if (empty($this->arrOptions)) {
            $this->arrOptions = array(
                array(
                    'value' => '',
                    'label' => '-'
                )
            );
        }

        $strClass = ('' !== $this->strClass ? ' class="' . $this->strClass . '"' : '');
        $strStyle = ('' !== $this->arrAttributes['style'] ? ' style="' . $this->arrAttributes['style'] . '"' : '');

        return $this->checkOptGroup($this->arrOptions, $strClass, $strStyle);
    }
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);
    }
360470
protected function generate()
    {
        foreach ($this->listFiles as $key => $file) {
            $filePath = $this->makeFilePath($this->listFolders[$key], $this->data['name']);

            $this->resolveByPath($filePath);

            $file = $this->formatContent($file);

            //
            $find = basename($filePath);

            $filePath = strrev(preg_replace(strrev("/$find/"), '', strrev($filePath), 1));

            $filePath = $filePath .$file;

            if ($this->files->exists($filePath)) {
                return $this->error($this->type .' already exists!');
            }

            $this->makeDirectory($filePath);

            foreach ($this->signOption as $option) {
                if ($this->option($option)) {
                    $stubFile = $this->listStubs[$option][$key];

                    $this->resolveByOption($this->option($option));

                    break;
                }
            }

            if (! isset($stubFile)) {
                $stubFile = $this->listStubs['default'][$key];
            }

            $this->files->put($filePath, $this->getStubContent($stubFile));
        }

        return $this->info($this->type.' created successfully.');
    }
456529
public function generate()
    {
        try {
            $args = $this->_splitArgs($this->args);
            $url = Router::url($args);
            $this->out("> $url");
            $this->out();
        } catch (MissingRouteException $e) {
            $this->err('<warning>The provided parameters do not match any routes.</warning>');
            $this->out();

            return false;
        }

        return true;
    }
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);
	}
885684
public function generate()
    {
        /** @var LogTable[] $availableLogTables */
        $availableLogTables = array();

        $this->tables->sort();

        foreach ($this->tables as $i => $table) {
            if (is_array($table)) {

                // join condition provided
                $alias = isset($table['tableAlias']) ? $table['tableAlias'] : $table['table'];

                if (isset($table['join'])) {
                    $this->joinString .= ' ' . $table['join'];
                } else {
                    $this->joinString .= ' LEFT JOIN';
                }

                if (!isset($table['joinOn']) && $this->tables->getLogTable($table['table'])) {
                    $logTable = $this->tables->getLogTable($table['table']);
                    if (!empty($availableLogTables)) {
                        $table['joinOn'] = $this->findJoinCriteriasForTables($logTable, $availableLogTables);
                    }
                    if (!isset($table['tableAlias'])) {
                        // eg array('table' => 'log_link_visit_action', 'join' => 'RIGHT JOIN')
                        // we treat this like a regular string table which we can join automatically
                        $availableLogTables[$table['table']] = $logTable;
                    }
                }

                $this->joinString .= ' ' . Common::prefixTable($table['table']) . " AS " . $alias
                                   . " ON " . $table['joinOn'];
                continue;
            }

            $tableSql = Common::prefixTable($table) . " AS $table";

            $logTable = $this->tables->getLogTable($table);

            if ($i == 0) {
                // first table
                $this->joinString .= $tableSql;
            } else {

                $join = $this->findJoinCriteriasForTables($logTable, $availableLogTables);

                if ($join === null) {
                    $availableLogTables[$table] = $logTable;
                    continue;
                }

                // the join sql the default way
                $this->joinString .= " LEFT JOIN $tableSql ON " . $join;
            }

            $availableLogTables[$table] = $logTable;
        }
    }
1065379
public function generate()
    {
        $this->_uuid = null;
        if (extension_loaded('uuid')) {
            if (function_exists('uuid_export')) {
                // UUID extension from http://www.ossp.org/pkg/lib/uuid/
                if (uuid_create($ctx) == UUID_RC_OK &&
                    uuid_make($ctx, UUID_MAKE_V4) == UUID_RC_OK &&
                    uuid_export($ctx, UUID_FMT_STR, $str) == UUID_RC_OK) {
                    $this->_uuid = $str;
                    uuid_destroy($ctx);
                }
            } else {
                // UUID extension from http://pecl.php.net/package/uuid
                $this->_uuid = uuid_create();
            }
        }
        if (!$this->_uuid) {
            list($time_mid, $time_low) = explode(' ', microtime());
            $time_low = (int)$time_low;
            $time_mid = (int)substr($time_mid, 2) & 0xffff;
            $time_high = mt_rand(0, 0x0fff) | 0x4000;

            $clock = mt_rand(0, 0x3fff) | 0x8000;

            $node_low = function_exists('zend_thread_id')
                ? zend_thread_id()
                : getmypid();
            $node_high = isset($_SERVER['SERVER_ADDR'])
                ? ip2long($_SERVER['SERVER_ADDR'])
                : crc32(php_uname());
            $node = bin2hex(pack('nN', $node_low, $node_high));

            $this->_uuid = sprintf('%08x-%04x-%04x-%04x-%s',
                $time_low, $time_mid, $time_high, $clock, $node);
        }
    }
566928
public function generate()
    {
        $result = '';

        $table  = $this->buildTable();
        $fields = $this->buildFields();

        $result.='INSERT INTO '.$table.' '.$fields;

        return $result;
    }
1345867
public function generateRequest()
    {
        if (!$this->confirm('Do you want to create form request classes?')) {
            return;
        }

        foreach (['Create', 'Update'] as $request) {
            $name = $this->getPrefix('/').$this->getEntities().'/'.$request.Str::studly($this->getEntity()).'Request';

            $this->console->call('generate:request', [
                'name' => $name,
                '--scaffold' => true,
                '--auth' => true,
                '--rules' => $this->existing() ? $this->getTableDumper()->toSchema() : $this->getFields(),
                '--force' => $this->console->option('force'),
            ]);
        }
    }
382270
public function make()
    {
        // empty table to start
        $table = [];
        // get the max length of each column in the table
        $field_lengths = $this->maxMultidimensionalArrayStringSize($this->data);
        // get the length of a row by mocking up a row
        $row_length = $this->calculateRowLength($field_lengths, $this->seperator_padding, $this->seperator);
        // get the top and bottom of the table
        $book_end = $this->su->fill($row_length, $this->header_character);
        // get the row that appears below the header row to seperate it from the other rows
        $below_header = $this->su->fill($row_length, $this->below_header_character);
        // add the top $book_end
        $table[] = $book_end;
        // loop over each 'row' in our array
        for ($i = 0; $i < count($this->data); $i++) {
            // line starts as just the left most seperator
            $line = $this->seperator . $this->su->fill($this->seperator_padding);
            // loop over each 'field' aka column in our row
            for ($j = 0; $j < count($this->data[$i]); $j++) {
                // format the fields such that they have a max length of the biggest field in this column
                // and add the additional padding, then pass this to the formatter method and append it to
                // the line and then add the seperator
                $line .= $this->su->{$this->formatter}($this->data[$i][$j], $field_lengths[$j]) . $this->su->fill($this->seperator_padding) . $this->seperator . $this->su->fill($this->seperator_padding);
            }
            // add the new line to the table
            $table[] = $line;
            // if this was the first row we will add a $below_header row to break it up
            if ($i == 0) {
                $table[] = $below_header;
            }
        }
        // add the bottom book end to the table
        $table[] = $book_end;
        // set the table data on the instance
        $this->table = $table;
        return $this;
    }
1057984
public static function generate()
    {
        if (class_exists('O2System\Filesystem\System')) {
            $system = new \O2System\Filesystem\System();

            $metadata = [
                'machine'         => $system->getMachine(),
                'operatingSystem' => [
                    'name'    => $system->getName(),
                    'version' => $system->getVersion(),
                    'release' => $system->getRelease(),
                ],
                'hostname'        => $system->getHostname(),
                'cpuCores'        => $system->getCpuCores(),
                'macAddress'      => $system->getMacAddress(),
            ];
        } else {
            $metadata = [
                'machine'         => php_uname('m'),
                'operatingSystem' => [
                    'name'    => php_uname('s'),
                    'version' => php_uname('v'),
                    'release' => php_uname('r'),
                ],
                'hostname'        => php_uname('n'),
                'cpuCores'        => 1,
                'macAddress'      => implode(':', str_split(substr(md5('none'), 0, 12), 2)),
            ];
        }

        $uri = new Uri();

        $metadata[ 'domain' ] = $uri->getHost();
        $metadata[ 'ipAddress' ] = $_SERVER[ 'SERVER_ADDR' ];

        $string = json_encode($metadata);
        $string = md5($string);

        // Converts to UUID (Universally Unique Identifier)
        $parts[] = substr($string, 0, 8);
        $parts[] = substr($string, 8, 4);
        $parts[] = substr($string, 12, 4);
        $parts[] = substr($string, 16, 4);
        $parts[] = substr($string, 20, 12);

        $parts = array_map('strtoupper', $parts);

        return implode('-', $parts);
    }
95345
public function generate()
	{
		$this->loadLanguageFile('rocksolid_custom_elements');

		$classes = ['tl_box', 'rsce_group'];
		$fs = \System::getContainer()->get('session')->getBag('contao_backend')->get('fieldset_states');

		if (
			(isset($fs[$this->strTable][$this->strId]) && !$fs[$this->strTable][$this->strId])
			|| (!isset($fs[$this->strTable][$this->strId]) && !empty($this->arrConfiguration['collapsed']))
		) {
			$classes[] = 'collapsed';
		}

		return '</fieldset>'
			. '<div class="clear"></div>'
			. '<fieldset'
			. ' id="pal_' . $this->strId . '"'
			. ' class="' . implode(' ', $classes) . '"'
			. '>'
			. '<legend'
			. ' onclick="AjaxRequest.toggleFieldset(this, &quot;' . $this->strId . '&quot;, &quot;' . $this->strTable . '&quot;)"'
			. '>' . $this->strLabel
			. '</legend>'
			. ($this->description ? '<p class="rsce_group_description">' . $this->description . '</p>' : '');
	}
789781
public function generateResponse(){
        // Create request
        $this->startTimeline("request.create");

        $request    = $this->container->get("app.request")
            ->withAttribute("app.debug", $this->debug)
        ;

        $this->endTimeline("request.create");

        // Create response
        $this->startTimeline("response.create");

        $response   = $this->container->newInstance(Response::class, [
            "handler"   => $this->generateHandler($request),
        ]);

        $this->endTimeline("response.create");

        return $response;
    }