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


PHP self::run方法代码示例

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


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

示例1: init

 public static function init($run = true)
 {
     static $console;
     if (!$console) {
         // 实例化console
         $console = new self('Think Console', '0.1');
         // 读取指令集
         if (is_file(CONF_PATH . 'command' . EXT)) {
             $commands = (include CONF_PATH . 'command' . EXT);
             if (is_array($commands)) {
                 foreach ($commands as $command) {
                     if (class_exists($command) && is_subclass_of($command, "\\think\\console\\command\\Command")) {
                         // 注册指令
                         $console->add(new $command());
                     }
                 }
             }
         }
     }
     if ($run) {
         // 运行
         $console->run();
     } else {
         return $console;
     }
 }
开发者ID:GDdark,项目名称:cici,代码行数:26,代码来源:Console.php

示例2: create

 /**
  * Create a new git repository
  *
  * Accepts a creation path, and, optionally, a source path
  *
  * @access public
  * @param string $repoPath repository path
  * @param string $source directory to source
  * @param bool $remoteSource reference path
  * @param string|null $reference
  * @throws \Exception
  * @return GitRepo
  */
 public static function create($repoPath, $source = null, $remoteSource = false, $reference = null, $commandString = "")
 {
     if (is_dir($repoPath) && file_exists($repoPath . "/.git") && is_dir($repoPath . "/.git")) {
         throw new GitException(sprintf('"%s" is already a git repository', $repoPath));
     } else {
         $repo = new self($repoPath, true, false);
         if (is_string($source)) {
             if ($remoteSource) {
                 if (!is_dir($reference) || !is_dir($reference . '/.git')) {
                     throw new GitException('"' . $reference . '" is not a git repository. Cannot use as reference.');
                 } else {
                     if (strlen($reference)) {
                         $reference = realpath($reference);
                         $reference = "--reference {$reference}";
                     }
                 }
                 $repo->cloneRemote($source, $reference);
             } else {
                 $repo->cloneFrom($source, $commandString);
             }
         } else {
             $repo->run('create');
         }
         return $repo;
     }
 }
开发者ID:coyl,项目名称:git,代码行数:39,代码来源:GitRepo.php

示例3: exec

 public static final function exec($data)
 {
     $process = new self();
     $process->run($data);
     Log::info(' === ' . $process->getName() . ' ==== started === ');
     return $process;
 }
开发者ID:Natuka,项目名称:zeus-php,代码行数:7,代码来源:Multiprocess.php

示例4: self

 static function &create_new($repo_path, $gitdir = null, $source = null, $remote_source = false, $reference = null)
 {
     if ($gitdir && is_dir($gitdir) || is_dir($repo_path) && is_dir($repo_path . "/.git")) {
         throw new \Exception('"' . $repo_path . '" is already a git repository');
     } else {
         $repo = new self($repo_path, $gitdir, true, false);
         if (is_string($source)) {
             if ($remote_source) {
                 if (!is_dir($reference) || !is_dir($reference . '/.git')) {
                     throw new \Exception('"' . $reference . '" is not a git repository. Cannot use as reference.', 1);
                 } else {
                     if (strlen($reference)) {
                         $reference = realpath($reference);
                         $reference = "--reference {$reference}";
                     }
                 }
                 $repo->clone_remote($source, $reference);
             } else {
                 $repo->clone_from($source);
             }
         } else {
             $repo->run('init');
         }
         return $repo;
     }
 }
开发者ID:surikat,项目名称:git-cascade,代码行数:26,代码来源:GitRepo.php

示例5: testNotExistingTestCase

 public function testNotExistingTestCase()
 {
     $suite = new self('notExistingMethod');
     $suite->run($this->result);
     $this->assertEquals(0, $this->result->errorCount());
     $this->assertEquals(1, $this->result->failureCount());
     $this->assertEquals(1, count($this->result));
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:8,代码来源:SuiteTest.php

示例6: classConstructor

 /**
  * Serves as entry point for this script.
  *
  * It runs several benchmark iteratios.
  *
  * @return void
  */
 public static function classConstructor()
 {
     $cases = array(array(10, 1), array(100, 1), array(1000, 1), array(10000, 1), array(10, 10), array(100, 10), array(1000, 10), array(10000, 10), array(100, 100), array(1000, 100), array(10000, 100), array(1000, 1000), array(10000, 1000), array(10000, 10000));
     foreach ($cases as $case) {
         $benchmark = new self($case[0], $case[1]);
         $benchmark->run();
         echo $benchmark;
     }
 }
开发者ID:rolwi,项目名称:koala,代码行数:16,代码来源:AutoloaderBenchmark.php

示例7: spawn

 public static function spawn($cb)
 {
     if (!$cb instanceof \Generator) {
         return;
     }
     $instance = new self($cb);
     $instance->run();
     return $instance;
 }
开发者ID:coooold,项目名称:swCoroutine,代码行数:9,代码来源:Coroutine.class.php

示例8: main

 public static function main($cwd, array $argv = array())
 {
     try {
         $generator = new self($cwd, $argv);
         return $generator->run();
     } catch (Exception $e) {
         $generator->echoLine($e->getMessage());
         return $e->getCode();
     }
 }
开发者ID:Weltraumschaf,项目名称:weltraumschaf.de,代码行数:10,代码来源:Generator.php

示例9: is_valid

 /**
  * Shorthand method for inline validation.
  *
  * @param array $data       The data to be validated
  * @param array $validators The GUMP validators
  *
  * @return mixed True(boolean) or the array of error messages
  */
 public static function is_valid(array $data, array $validators)
 {
     $gump = new self();
     $gump->validation_rules($validators);
     if ($gump->run($data) === false) {
         return $gump->get_readable_errors(false);
     } else {
         return true;
     }
 }
开发者ID:Neko-cat,项目名称:nekofolio,代码行数:18,代码来源:gump.class.php

示例10: main

 public static function main()
 {
     if ($cwd = getenv('CURRENT_WORKING_DIRECTORY')) {
         if (!file_exists($cwd)) {
             exit('Invalid CURRENT_WORKING_DIRECTORY');
         }
         chdir($cwd);
     }
     $cliRunner = new self();
     $cliRunner->run();
 }
开发者ID:ralphschindler,项目名称:PHPTools,代码行数:11,代码来源:CLIRunner.php

示例11: is_valid

 /**
  * Shorthand method for inline validation
  *
  * @param array $data The data to be validated
  * @param array $validators The GUMP validators
  * @return mixed True(boolean) or the array of error messages
  */
 public static function is_valid(array $data, array $validators)
 {
     $formBuilder = new self();
     // GumpFormBuilder();
     $formBuilder->form_rules($validators);
     if ($formBuilder->run($data) === false) {
         return $formBuilder->get_readable_errors(false);
     } else {
         return true;
     }
 }
开发者ID:rwitchell,项目名称:gump-form-builder,代码行数:18,代码来源:GumpFormBuilder.php

示例12: main

 public static function main($args)
 {
     if (!$args) {
         throw new Exception('Hippo must be run from command line interface.');
     }
     $environment = new Environment();
     $fileSystem = new FileSystem();
     $configReader = new YAMLConfigReader($fileSystem);
     $checkRepository = new CheckRepository($fileSystem);
     $pathToSelf = array_shift($args);
     $context = new HippoTextUIContext($fileSystem, $args);
     $hippoTextUi = new self($environment, $fileSystem, $checkRepository, $configReader, $pathToSelf, $context);
     $hippoTextUi->run();
 }
开发者ID:hippophp,项目名称:hippo,代码行数:14,代码来源:HippoTextUI.php

示例13: start

 /**
  * Start
  *
  * @access public
  */
 public static function start()
 {
     if (self::is_running()) {
         throw new \Exception('Transaction daemon is already running');
     }
     $pid = pcntl_fork();
     if ($pid == -1) {
         throw new \Exception('Error while forking');
     } elseif ($pid) {
         file_put_contents(Config::$pid_file, $pid);
         return $pid;
     } else {
         // Child
         $daemon = new self();
         $daemon->run();
     }
 }
开发者ID:tigron,项目名称:skeleton-transaction,代码行数:22,代码来源:Daemon.php

示例14: start

 public static function start($template)
 {
     $ctx = $template->context;
     $loop = $ctx->get('loop');
     $box_id = $ctx->get('box_id');
     if (!$loop) {
         $box = new self($ctx, $box_id);
     } else {
         $obj_var = 'box_obj_' . $box_id;
         if (isset($loop[$obj_var])) {
             $box = $loop[$obj_var];
         } else {
             $box = new self($ctx, $box_id, $loop);
             $loop[$obj_var] = $box;
         }
     }
     $box->run($template);
     return $box;
 }
开发者ID:floxim,项目名称:module-ui,代码行数:19,代码来源:Box.php

示例15: main

 public static function main($exit = true)
 {
     $command = new self();
     if (wfIsWindows()) {
         # Windows does not come anymore with ANSI.SYS loaded by default
         # PHPUnit uses the suite.xml parameters to enable/disable colors
         # which can be then forced to be enabled with --colors.
         # The below code inject a parameter just like if the user called
         # phpunit with a --no-color option (which does not exist). It
         # overrides the suite.xml setting.
         # Probably fix bug 29226
         $command->arguments['colors'] = false;
     }
     # Makes MediaWiki PHPUnit directory includable so the PHPUnit will
     # be able to resolve relative files inclusion such as suites/*
     # PHPUnit uses stream_resolve_include_path() internally
     # See bug 32022
     set_include_path(__DIR__ . PATH_SEPARATOR . get_include_path());
     $command->run($_SERVER['argv'], $exit);
 }
开发者ID:Jobava,项目名称:diacritice-meta-repo,代码行数:20,代码来源:MediaWikiPHPUnitCommand.php


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