本文整理汇总了PHP中Executor类的典型用法代码示例。如果您正苦于以下问题:PHP Executor类的具体用法?PHP Executor怎么用?PHP Executor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Executor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFlush
public function testFlush()
{
$streams = $this->provideStreams();
$executor = new Executor();
$this->assertSame(0, $executor->flush('echo foo', $streams));
rewind($streams[0]);
$this->assertSame('', fread($streams[0], 1024));
rewind($streams[1]);
$this->assertSame("foo\r\n", fread($streams[1], 1024));
rewind($streams[2]);
$this->assertSame('', fread($streams[2], 1024));
}
示例2: run
/**
* Call this function to execute jobs which are due to occur now.
*/
public function run()
{
$jobs = $this->jobFinder->find();
if (is_null($jobs)) {
return;
}
foreach ($jobs as $job) {
// TODO Should jobs be locked prior to running them?
$start = date('Y-m-d H:i:s', time());
$executor = new Executor($job);
$response = $executor->run();
$finish = date('Y-m-d H:i:s', time());
$this->addJobToHistory($job, $response, $start, $finish);
$this->sendNotifications($job, $response, $start, $finish);
}
}
示例3: getAllByPopular
public static function getAllByPopular()
{
// $sql = "select * from ".self::$tablename;
$sql = "select *,count(*) as total from " . self::$tablename . " group by channel_id limit 10";
$query = Executor::doit($sql);
return Model::many($query[0], new FollowerData());
}
示例4: __construct
public function __construct()
{
$arr = Executor::execute("df -PB 1");
foreach ($arr as $line) {
$columns = preg_split("/ /", $line, -1, PREG_SPLIT_NO_EMPTY);
$this->df[$columns[0]] = array("capacity" => $columns[1], "used" => $columns[2], "available" => $columns[3], "percent" => $columns[4], "path" => $columns[5]);
}
}
示例5: one_object
public static function one_object($sql)
{
$query = Executor::doit($sql);
$cnt = 0;
$found = null;
$data = null;
while ($r = $query[0]->fetch_object()) {
$data = $r;
$found = $data;
break;
}
return $found;
}
示例6: getByName
public static function getByName($name)
{
$sql = "select * from " . self::$tablename . " where name=\"{$name}\"";
$query = Executor::doit($sql);
$found = null;
$data = new StatusData();
while ($r = $query->fetch_array()) {
$data->id = $r['id'];
$data->name = $r['name'];
$found = $data;
break;
}
return $found;
}
示例7: PHP_debug_backtrace
function PHP_debug_backtrace(Executor $executor, array $args, Zval $return)
{
$array = array();
$current = $executor->getCurrent();
while ($current->parent) {
$parent = $current->parent;
$ret = array('line' => $parent->opLine->attributes['startLine'], 'file' => $parent->opArray->getFileName());
if ($current->function) {
if ($current->ci) {
$ret['class'] = $current->ci->getClassEntry()->getName();
$ret['object'] = $current->ci;
$ret['type'] = '->';
$ret['function'] = $current->ci->getClassEntry()->getMethodStore()->getName($current->function);
} else {
$ret['function'] = $current->executor->getFunctionStore()->getName($current->function);
}
$ret['args'] = $current->arguments;
}
$array[] = $ret;
$current = $parent;
}
$return->setValue($array);
}
示例8: getAll
public static function getAll()
{
$sql = "select * from " . self::$tablename;
$query = Executor::doit($sql);
$array = array();
$cnt = 0;
while ($r = $query->fetch_array()) {
$array[$cnt] = new UserTypeData();
$array[$cnt]->id = $r['id'];
$array[$cnt]->name = $r['name'];
$cnt++;
}
return $array;
}
示例9: getAll
public static function getAll()
{
$sql = "select * from " . self::$tablename . " order by created_at desc";
$query = Executor::doit($sql);
$array = array();
$cnt = 0;
while ($r = $query[0]->fetch_array()) {
$array[$cnt] = new OperationTypeData();
$array[$cnt]->id = $r['id'];
$array[$cnt]->name = $r['name'];
$cnt++;
}
return $array;
}
示例10: getLike
public static function getLike($q)
{
$sql = "select * from " . self::$tablename . " where name like '%{$q}%'";
$query = Executor::doit($sql);
$array = array();
$cnt = 0;
while ($r = $query[0]->fetch_array()) {
$array[$cnt] = new BoxData();
$array[$cnt]->id = $r['id'];
$array[$cnt]->created_at = $r['created_at'];
$cnt++;
}
return $array;
}
示例11: Event_handler
function Event_handler($handler)
{
if (is_object($handler)) {
return array('type' => 'object', 'object' => $handler, 'event_handler' => true);
} elseif (is_string($handler) && class_exists($handler)) {
return array('type' => 'class', 'class' => $handler, 'event_handler' => true);
} else {
if (is_array($handler)) {
return array('type' => 'bootable', 'boot' => \Collection::create($handler), 'event_handler' => true);
} else {
return array('type' => 'bootable', 'boot' => \Executor::create($handler), 'event_handler' => true);
}
}
}
示例12: getAll
public static function getAll()
{
$sql = "select * from " . self::$tablename . " order by created_at desc";
$query = Executor::doit($sql);
$array = array();
$cnt = 0;
while ($r = $query->fetch_array()) {
$array[$cnt] = new AlbumImageData();
$array[$cnt]->album_id = $r['album_id'];
$array[$cnt]->image_id = $r['image_id'];
$array[$cnt]->created_at = $r['created_at'];
$cnt++;
}
return $array;
}
示例13: __call
/**
* Catch all calls, fire events and remap to real instance
*
* @access public
* @param string $method
* @param array $args
* @return mixed
*/
public function __call($method, array $args = array())
{
$event = $this->observer->createEvent()->setMethod($method)->setParams($args)->setInstance($this)->setType('before');
$before = $this->observer->trigger()->getResult();
if ($event->isPropagationStopped()) {
return $before;
}
/** @var \Closure $closure */
if ($closure = $this->observer->bound($method)) {
$callback = $closure->bindTo($this, $this);
$result = Executor::callClosure($callback, $event->getParams());
} else {
$result = Executor::call($this(true), $method, $event->getParams());
}
$event->setType('after')->setResult($result);
return $this->observer->trigger()->getResult();
}
示例14: getAll
public static function getAll()
{
$sql = "select * from " . self::$tablename . "";
$query = Executor::doit($sql);
$array = array();
$cnt = 0;
while ($r = $query[0]->fetch_array()) {
$array[$cnt] = new ThemeData();
$array[$cnt]->id = $r['id'];
$array[$cnt]->name = $r['name'];
$array[$cnt]->header_background_color = $r['header_background_color'];
$array[$cnt]->header_text_color = $r['header_text_color'];
$array[$cnt]->body_background_color = $r['body_background_color'];
$array[$cnt]->body_text_color = $r['body_text_color'];
$cnt++;
}
return $array;
}
示例15: getInputByProductIdCutIdYesF
public static function getInputByProductIdCutIdYesF($product_id, $cut_id)
{
$sql = "select * from " . self::$tablename . " where product_id={$product_id} and cut_id={$cut_id} and operation_type_id=1 order by created_at desc";
$query = Executor::doit($sql);
return Model::many($query[0], new OperationData());
}