当前位置: 首页>>代码示例>>PHP>>正文


PHP Generator::generate方法代码示例

本文整理汇总了PHP中Generator::generate方法的典型用法代码示例。如果您正苦于以下问题:PHP Generator::generate方法的具体用法?PHP Generator::generate怎么用?PHP Generator::generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Generator的用法示例。


在下文中一共展示了Generator::generate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run ZMQ interface for generator
  * 
  * Req-rep pattern; msgs are commands:
  * 
  * GEN    = Generate ID
  * STATUS = Get status string
  */
 public function run()
 {
     $context = new \ZMQContext();
     $receiver = new \ZMQSocket($context, \ZMQ::SOCKET_REP);
     $bindTo = 'tcp://*:' . $this->port;
     echo "Binding to {$bindTo}\n";
     $receiver->bind($bindTo);
     while (TRUE) {
         $msg = $receiver->recv();
         switch ($msg) {
             case 'GEN':
                 try {
                     $response = $this->generator->generate();
                 } catch (\Exception $e) {
                     $response = "ERROR";
                 }
                 break;
             case 'STATUS':
                 $response = json_encode($this->generator->status());
                 break;
             default:
                 $response = 'UNKNOWN COMMAND';
                 break;
         }
         $receiver->send($response);
     }
 }
开发者ID:Minds,项目名称:cruftflake,代码行数:35,代码来源:ZeroMq.php

示例2: testGeneratingUuidShouldReturnDifferentResultEveryTime

 /**
  * Generating UUID should return different results every time
  *
  * @covers Mixpanel\Uuid\Generator::generate
  * @covers Mixpanel\Uuid\Generator::ticksEntropy
  * @covers Mixpanel\Uuid\Generator::uaEntropy
  * @covers Mixpanel\Uuid\Generator::randomEntropy
  * @covers Mixpanel\Uuid\Generator::ipEntropy
  */
 public function testGeneratingUuidShouldReturnDifferentResultEveryTime()
 {
     $uuids = array();
     for ($i = 0; $i < 100; $i++) {
         $uuid = $this->generator->generate('user-agent', '127.0.0.1');
         $this->assertNotContains($uuid, $uuids);
         $uuids[] = $uuid;
     }
 }
开发者ID:wpfw,项目名称:mixpanel-php,代码行数:18,代码来源:GeneratorTest.php

示例3: create

 /**
  * Creates accessor for instances of given class.
  * @param string $class
  * @return Accessor
  */
 public function create($class)
 {
     $name = $this->naming->deriveClassName($class);
     $namespaced = $this->naming->getNamespace() . '\\' . $name;
     if (class_exists($namespaced) || $this->cache && $this->cache->load($name)) {
         return new $namespaced();
     }
     $definition = $this->generator->generate($class);
     if ($this->cache) {
         $this->cache->save($name, $definition);
     }
     eval($definition);
     return new $namespaced();
 }
开发者ID:markatom,项目名称:accessor,代码行数:19,代码来源:Factory.php

示例4: generate

 /**
  * Generates XML code
  * @throws FeedGeneratorException
  */
 public function generate()
 {
     if (!$this->_generator instanceof Generator) {
         throw new FeedGeneratorException('There has been no generator strategy set.');
     }
     $this->generated = $this->_generator->generate($this->_channel);
 }
开发者ID:carriercomm,项目名称:yaketystats,代码行数:11,代码来源:FeedGenerator.php

示例5: generateSql

 public function generateSql()
 {
     $namespace = \Zule\Tools\Config::zc()->framework->application_namespace;
     $system = 'Zule';
     $tables = $this->settings->getTables();
     foreach ($tables as $table) {
         $s = new \Smarty();
         $tableName = $table->getName();
         // generate model
         $s->assign('model_name', $_POST["class_{$tableName}"]);
         $s->assign('namespace', $namespace);
         $s->assign('system', $system);
         $s->assign('class_name', $_POST["class_{$tableName}"]);
         $s->assign('extend_path', '\\Zule\\Models\\Model');
         $s->assign('impl_date', date('Y-m-d H:i:s'));
         $s->assign('use_unsafe_setters', 0);
         $s->assign('table_name', $tableName);
         $columns = $table->getColumns();
         $s->assign('columns', $columns);
         $s->assign('primary_key', $table->getPrimaryKey());
         $gen = new Generator("../models/" . $_POST["class_{$tableName}"] . '.php');
         $gen->generate($s, 'model_sql');
         $gen = new Generator("../models/Data/" . $_POST["class_{$tableName}"] . '.php');
         $gen->generate($s, 'gateway_sql');
     }
 }
开发者ID:ryanknu,项目名称:zule-framework,代码行数:26,代码来源:model_generator.php

示例6: execute

 function execute()
 {
     $generator_class = $this->generator_class;
     foreach ($this->values as $index => $value) {
         Generator::generate($value, new $generator_class($value, $this->parent, $this->args));
     }
 }
开发者ID:wplib,项目名称:json-loader,代码行数:7,代码来源:ArrayGenerator.php

示例7: main

function main()
{
    $args = \Docopt::handle(<<<s
A PHP class autoload generator with support for functions and constants.

Example:

    generate-autoload src/autoload.php

        Will write an autoloader for everything in "src/" to "src/autoload.php".

    generate-autoload autoload.php src --exclude src/Bar lib/functions.php

        Will write to an autoloader for everything in "src/" and
        "lib/functions.php", except for everything in "src/Bar", to "autoload.php".

Usage:
    generate-autoload [options] <outfile> [<files>...] [--exclude <file>]...
    generate-autoload -h|--help

Options:
    --require-method=<method>  One of "include", "require", "include_once" or
                               "require_once". [default: require_once]
    --case-insensitive         Autoload classes case insensitively. Will involve
                               a strtolower() call every time a class is loaded.
    --prepend                  Third parameter to spl_autoload_register().
    --exclude <file>           Exclude a file/directory.

s
);
    $outFile = $args['<outfile>'];
    $files = array_diff(iterator_to_array(flatten_input_paths($args['<files>'] ?: [dirname($outFile)])), iterator_to_array(flatten_input_paths($args['--exclude'])));
    global $argv;
    $options = new GeneratorOptions();
    $options->requireMethod = $args['--require-method'];
    $options->prependAutoload = $args['--prepend'];
    $options->caseInsensitive = $args['--case-insensitive'];
    $options->generatedBy = join(' ', $argv);
    $generator = new Generator();
    foreach ($files as $file) {
        print "Scanning {$file}\n";
        $generator->addFile($file);
    }
    print "\n";
    file_put_contents($outFile, $generator->generate(dirname($outFile), $options));
    print "Output written to {$outFile}\n";
}
开发者ID:jesseschalken,项目名称:autoload-generator,代码行数:47,代码来源:main.php

示例8: main

 public static function main($e)
 {
     $io = $e->getIO();
     $args = $e->getArguments();
     $command = @$args[0];
     switch ($command) {
         case 'generate':
             $arg2 = @$args[1];
             if (!$arg2) {
                 $io->writeError('ERROR: You must provide a directory to generate the style guide');
             } else {
                 $generator = new Generator($io);
                 $generator->generate($arg2);
             }
             break;
         default:
             $io->write(self::$usage . PHP_EOL);
             break;
     }
 }
开发者ID:mindgruve,项目名称:style-guide,代码行数:20,代码来源:CommandLine.php

示例9: isset

                    <small class="notice">Tables in red have been previously created</small>
                    
                    <label class="checkbox inline">
                        <input type="checkbox" id="inputBackup" name="backup" value="1" checked /> Enable automatic backup of models
                    </label>
                </div>
            </div>
            
            <br />
            <input type="button" value="BACK" class="btn btn-primary" onclick="javascript:history.back()" />
            <input type="submit" value="NEXT" class="btn btn-primary" />
        </fildset>
    </form>

    <?php 
    exit;
}
//***************************************************
// STEP 3
//***************************************************
// Enable automatic backup of models
$backup = isset($_POST['backup']) ? (bool) $_POST['backup'] : null;
$database = isset($_POST['database']) ? $_POST['database'] : null;
$tables = isset($_POST['tables']) ? (array) $_POST['tables'] : null;
Generator::setBackup($backup);
Generator::generate($database, $tables);
echo '<br /><input type="button" value="FINISH" class="btn btn-primary" onclick="javascript:history.go(-2);" /><br /><br /><br /><br />';
?>
</div>
</body>
</html>
开发者ID:vladmeh,项目名称:zf_generate_models,代码行数:31,代码来源:index.php

示例10: Config

}
if ($cli->getValue('--xsiArrayType')) {
    $optionsArray[] = 'SOAP_USE_XSI_ARRAY_TYPE';
}
if ($cli->getValue('--waitOneWayCalls')) {
    $optionsArray[] = 'SOAP_WAIT_ONE_WAY_CALLS';
}
$wsdlCache = '';
if ($cli->getValue('--cacheNone')) {
    $wsdlCache = 'WSDL_CACHE_NONE';
} else {
    if ($cli->getValue('--cacheDisk')) {
        $wsdlCache = 'WSDL_CACHE_DISK';
    } else {
        if ($cli->getValue('--cacheMemory')) {
            $wsdlCache = 'WSDL_CACHE_MEMORY';
        } else {
            if ($cli->getValue('--cacheBoth')) {
                $wsdlCache = 'WSDL_CACHE_BOTH';
            }
        }
    }
}
$gzip = '';
if ($cli->getValue('--gzip')) {
    $gzip = 'SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP';
}
$config = new Config($inputFile, $outputDir, $verbose, $singleFile, $classExists, $noTypeConstructor, $namespaceName, $optionsArray, $wsdlCache, $gzip, $classNames, $prefix, $suffix);
$generator = new Generator();
$generator->generate($config);
开发者ID:rgantt,项目名称:wsdl2phpgenerator,代码行数:30,代码来源:generate.php

示例11: Generator

// Should we add the year to the title (eh: PyCon11 or PyCon2011 instead of PyCon?)
define("EVENT_ADD_YEAR_TO_TITLE", 10);
// 50% chance if the additional year added to the name is a full year (2011) instead of short year (11)
define("EVENT_ADD_FULLYEAR_TO_TITLE", 50);
// Percentage of anonymous comments on events
define("EVENT_COMMENT_IS_ANONYMOUS", 15);
// Percentage of anonymous comments on talks
define("TALK_COMMENT_IS_ANONYMOUS", 15);
// 5% of the comments are marked private
define("COMMENT_IS_PRIVATE", 5);
// Percentage of talks that is claimed
define("TALK_IS_CLAIMED", 75);
// Does the talk have multiple speakers
define("TALK_HAS_MULTIPLE_SPEAKERS", 20);
// Percentage of the talks that have slides associated with them
define("TALK_HAS_SLIDES", 35);
// Amount of claims that are still pending
define("TALK_SPEAKER_PENDING", 10);
// Percentage of talks that is claimed by a user that has registered through joind.in
define("TALK_IS_CLAIMED_BY_REGISTERED_USER", 75);
// Only 1 percent of the users is an admin
define("USER_IS_ADMIN", 1);
// 25% has a twitter account
define("USER_HAS_TWITTER", 25);
// ====================== NOTHING TO EDIT BELOW THIS POINT, MOVE ALONG ======================
require_once "generator_data.interface.php";
require_once "generator_data.class.php";
require_once "generator.class.php";
$gen = new Generator(new Generator_Data());
echo $gen->generate();
exit;
开发者ID:jaytaph,项目名称:joind.in,代码行数:31,代码来源:generate.php

示例12: __construct


//.........这里部分代码省略.........
             Core::init("installation_db_ready");
             $index = $post["index"];
             $countryPlugins = CountryPluginHelper::getCountryPlugins(false);
             if ($index >= count($countryPlugins)) {
                 $this->response["success"] = 1;
                 $this->response["content"] = "";
                 $this->response["isComplete"] = true;
             } else {
                 // attempt to install this data type
                 $currCountryPlugin = $countryPlugins[$index];
                 $this->response["countryName"] = $currCountryPlugin->getName();
                 $this->response["countryFolder"] = $currCountryPlugin->folder;
                 $this->response["isComplete"] = false;
                 try {
                     // always run the uninstallation function first to ensure any old data is all cleared out
                     $currCountryPlugin->uninstall();
                     list($success, $content) = $currCountryPlugin->install();
                     $this->response["success"] = $success;
                     $this->response["content"] = $content;
                 } catch (Exception $e) {
                     $this->response["success"] = false;
                     $this->response["content"] = "Unknown error.";
                 }
             }
             break;
         case "installationSaveCountries":
             Core::init("installation_db_ready");
             $folders = $post["folders"];
             $response = Settings::setSetting("installedCountries", $folders);
             $response = Settings::setSetting("installationComplete", "yes");
             $this->response["success"] = $response["success"];
             $this->response["content"] = $response["errorMessage"];
             break;
         case "generateInPage":
             Core::init("generation");
             $gen = new Generator($_POST);
             $response = $gen->generate();
             $this->response["success"] = $response["success"];
             $this->response["content"] = $response["content"];
             $this->response["isComplete"] = $response["isComplete"];
             break;
             // ------------------------------------------------------------------------------------
             // USER ACCOUNTS
             // ------------------------------------------------------------------------------------
         // ------------------------------------------------------------------------------------
         // USER ACCOUNTS
         // ------------------------------------------------------------------------------------
         case "getAccount":
             Core::init();
             $response = Core::$user->getAccount();
             $this->response["success"] = true;
             $this->response["content"] = $response;
             break;
         case "getUsers":
             Core::init();
             $response = Core::$user->getUsers();
             $this->response["success"] = $response["success"];
             if (isset($response["accounts"])) {
                 $this->response["content"] = $response["accounts"];
             }
             break;
         case "createAccount":
             Core::init();
             if (!Core::checkIsLoggedIn()) {
                 $this->response["success"] = false;
                 $this->response["errorCode"] = ErrorCodes::NOT_LOGGED_IN;
开发者ID:GrimDerp,项目名称:vagrant-synthetic-data-machine,代码行数:67,代码来源:AjaxRequest.class.php

示例13: docdown

/**
 * Generates Markdown from JSDoc entries in a given file.
 *
 * @param {Array} [$options=array()] The options array.
 * @returns {String} The generated Markdown.
 * @example
 *
 * // specify a file path
 * $markdown = docdown(array(
 *   // path to js file
 *   'path' => $filepath,
 *   // url used to reference line numbers in code
 *   'url' => 'https://github.com/username/project/blob/master/my.js'
 * ));
 *
 * // or pass raw js
 * $markdown = docdown(array(
 *   // raw JavaScript source
 *   'source' => $rawJS,
 *   // documentation title
 *   'title' => 'My API Documentation',
 *   // url used to reference line numbers in code
 *   'url' => 'https://github.com/username/project/blob/master/my.js'
 * ));
 */
function docdown($options = array())
{
    $gen = new Generator($options);
    return $gen->generate();
}
开发者ID:splade,项目名称:nes,代码行数:30,代码来源:docdown.php

示例14: getAllKnown

 public function getAllKnown()
 {
     $allDoctypes = array();
     foreach ($this->knownMatrix as $category => $instances) {
         foreach ($instances as $instance) {
             $parentCategory = $category;
             $key = $parentCategory . '-' . str_replace('.', '', $instance['version']);
             $module = null;
             $generator = new Generator();
             if ($this->multiline === true) {
                 $generator->multiline();
             }
             if ($this->noUri === true) {
                 $generator->noUri();
             }
             if ($this->lowercasePrefix === true) {
                 $generator->lowercasePrefix();
             }
             if ($this->lowercaseFpi === true) {
                 $generator->lowercaseFpi();
             }
             if ($this->uppercaseFpi === true) {
                 $generator->uppercaseFpi();
             }
             if ($this->isModuleCategory($parentCategory)) {
                 $module = $this->getModuleFromCategory($parentCategory);
                 $parentCategory = $this->getParentCategoryFromModuleCategory($parentCategory);
             }
             $generator->{$parentCategory}();
             $generator->version($instance['version']);
             if (!is_null($module)) {
                 $generator->module($module);
             }
             if (isset($instance['variant'])) {
                 $key .= '-' . $instance['variant'];
                 $generator->variant($instance['variant']);
             }
             if (isset($instance['moduleVersion'])) {
                 $key .= '-' . str_replace('.', '', $instance['moduleVersion']);
                 $generator->moduleVersion($instance['moduleVersion']);
             }
             $allDoctypes[$key] = $generator->generate();
         }
     }
     return $allDoctypes;
 }
开发者ID:webignition,项目名称:html-document-type-generator,代码行数:46,代码来源:Generator.php

示例15: testGenerateFunctionMustBeOverwritten

 /**
  * @expectedException RuntimeException
  */
 public function testGenerateFunctionMustBeOverwritten()
 {
     $generator = new Generator();
     $generator->generate(new Invoice());
 }
开发者ID:bilalghouri,项目名称:KnpInvoice,代码行数:8,代码来源:GeneratorTest.php


注:本文中的Generator::generate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。