本文整理汇总了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;
}
}
示例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;
}
}
示例3: exec
public static final function exec($data)
{
$process = new self();
$process->run($data);
Log::info(' === ' . $process->getName() . ' ==== started === ');
return $process;
}
示例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;
}
}
示例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));
}
示例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;
}
}
示例7: spawn
public static function spawn($cb)
{
if (!$cb instanceof \Generator) {
return;
}
$instance = new self($cb);
$instance->run();
return $instance;
}
示例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();
}
}
示例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;
}
}
示例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();
}
示例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;
}
}
示例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();
}
示例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();
}
}
示例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;
}
示例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);
}