本文整理汇总了PHP中isAke函数的典型用法代码示例。如果您正苦于以下问题:PHP isAke函数的具体用法?PHP isAke怎么用?PHP isAke使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isAke函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public static function get($class, $key = null)
{
$key = is_null($key) ? sha1($class) : $key;
$classInstances = isAke(static::$instances, $class);
$keyInstance = isAke($classInstances, $key, null);
return $keyInstance;
}
示例2: __call
public function __call($method, $args)
{
if (true === $this->__has($method)) {
return $this->__fire($method, $args);
}
$reverse = strrev($method);
$last = $reverse[0];
if ('s' == $last) {
if (!count($args)) {
return isAke($this->values, $method);
} else {
$this->values[$method] = !Arrays::is($this->values[$method]) ? array() : $this->values[$method];
foreach ($args as $arg) {
array_push($this->values[$method], $arg);
}
}
return $this;
} else {
$method .= 's';
if (!count($args)) {
$val = isAke($this->values, $method);
return count($val) ? Arrays::first($val) : null;
} else {
$this->values[$method] = !Arrays::is($this->values[$method]) ? array() : $this->values[$method];
foreach ($args as $arg) {
array_push($this->values[$method], $arg);
}
}
return $this;
}
}
示例3: displayCodeLines
function displayCodeLines()
{
$back = '';
// $traces = Thin\Input::globals('dbg_stack', []);
$traces = debug_backtrace();
array_pop($traces);
if (!empty($traces)) {
foreach ($traces as $trace) {
$file = isAke($trace, 'file', false);
$line = isAke($trace, 'line', false);
if (false !== $file && false !== $line && $file != __FILE__) {
$start = $line > 5 ? $line - 5 : $line;
$code = Thin\File::readLines($file, $start, $line + 5);
$lines = explode("\n", $code);
$codeLines = [];
$i = $start;
foreach ($lines as $codeLine) {
if ($i == $line) {
array_push($codeLines, $i . '. <span style="background-color: gold; color: black;">' . $codeLine . '</span>');
} else {
array_push($codeLines, $i . '. ' . $codeLine);
}
$i++;
}
if (strlen($back)) {
$back .= "\n";
}
$back .= "File: {$file} [<em>line: <u>{$line}</u></em>]\n\nCode\n*******************************\n<div style=\"font-weight: normal; font-family: Consolas;\">" . implode("\n", $codeLines) . "</div>\n*******************************\n";
}
}
}
return $back;
}
示例4: run
public function run()
{
foreach ($this->logics as $k) {
$step = isAke($this->steps, $k, null);
if ($step) {
$action = isAke($step, 'action', null);
if ($action) {
$a = array_merge(isAke($step, 'action', []), [$this->instance]);
$check = call_user_func_array($action, $a);
if ($check) {
$this->successes[] = $k;
$success = isAke($step, 'success', null);
if ($success) {
call_user_func_array($success, [$this->instance]);
}
} else {
$this->errors[] = $k;
$error = isAke($step, 'error', null);
if ($error) {
call_user_func_array($error, [$this->instance]);
}
}
} else {
$this->errors[] = $k;
$error = isAke($step, 'error', null);
if ($error) {
call_user_func_array($error, [$this->instance]);
}
}
}
}
return ['successes' => $this->successes, 'errors' => $this->errors];
}
示例5: connect
/**
* Connect to MongoDB, select database
*
* @return bool
*/
public function connect()
{
if ($this->_connection) {
return;
}
/**
* Add required variables
* Clear the connection parameters for security
*/
$options = $this->_config->assoc();
unset($this->_config);
$hostname = isAke($options, 'hostname', 'localhost');
$port = isAke($options, 'port', '27017');
$conn = 'mongodb://' . $hostname . ':' . $port;
unset($options['hostname']);
unset($options['port']);
$this->_connection = new \Mongo($conn, $options);
/* Try connect */
try {
$this->_connection->connect();
} catch (\MongoConnectionException $e) {
throw new \Exception('Unable to connect to MongoDB server at ' . $hostname);
}
$this->_db = new \MongoDB($this->_connection, $options['db']);
return $this->_connected = TRUE;
}
示例6: __callStatic
public static function __callStatic($method, $args)
{
if (!isset(self::$resources[$method])) {
throw new Exception("[{$name}] is not a known resource.");
}
return isAke(self::$resources, $method);
}
示例7: table
public function table($table)
{
$instance = isAke($this->tables, $table);
if (null === $onstance) {
$instance = new Store($table);
}
}
示例8: format
private function format($text = '', $parameters = array())
{
if (!Arrays::is($parameters) && 'NONE' == $parameters) {
return $text;
}
if (!Arrays::is($parameters) && isset($this->styles[$parameters])) {
$parameters = $this->styles[$parameters];
}
$codes = array();
$fg = isAke($parameters, 'fg', null);
$bg = isAke($parameters, 'bg', null);
if (!empty($fg)) {
$codes[] = $this->foreground[$fg];
}
if (!empty($bg)) {
$codes[] = $this->background[$bg];
}
foreach ($this->options as $option => $value) {
$paramOpt = isAke($parameters, $option, null);
if (!empty($paramOpt)) {
$codes[] = $value;
}
}
return "[" . implode(';', $codes) . 'm' . $text . "[0m";
}
示例9: listen
public function listen()
{
set_time_limit(false);
$dbTask = Model::Latertask();
$dbInstance = Model::Laterinstance();
$tasks = $dbTask->where(['when', '<', time()])->cursor();
if ($tasks->count() > 0) {
foreach ($tasks as $task) {
$check = $dbInstance->where(['task_id', '=', (int) $task['id']])->cursor()->count();
$callback_id = isAke($task, 'callback_id', null);
if ($check == 0) {
$instance = $dbInstance->create(['task_id' => (int) $task['id'], 'start' => time()])->save();
$res = lib('closure')->fireStore((int) $task['closure_id'], (array) $task['args']);
if ($callback_id) {
$cb = $dbTask->find((int) $callback_id);
$t = $cb->toArray();
$args = array_merge([$res], $t['args']);
$res = lib('closure')->fireStore((int) $t['closure_id'], (array) $args);
$cb->delete();
}
$dt = $dbTask->find((int) $task['id']);
if ($dt) {
$dt->delete();
}
$instance->delete();
Model::Laterhistory()->create(['task' => (array) $task, 'execution_time' => time()])->save();
}
}
}
return true;
}
示例10: instance
public static function instance($ns = 'core')
{
$i = isAke(self::$instances, $ns, false);
if (!$i) {
self::$instances[$ns] = $i = lib('now', [$ns]);
}
return $i;
}
示例11: create
public function create($args)
{
$points = isAke($args, 'points', false);
if (false === $points) {
$args['points'] = 0;
}
return Model::Account()->create($args)->save();
}
示例12: getValue
public function getValue($username, $field, $default = null)
{
$row = coll(Now::get('acl.users.' . $this->ns, []))->firstBy('username', $username);
if ($row) {
return isAke($row, $field, $default);
}
return $default;
}
示例13: fire
public function fire($event, $parameters = [])
{
$events = Now::get('core.events', []);
$closure = isAke($events, $event, null);
if ($closure) {
return call_user_func_array($closure, $parameters);
}
return null;
}
示例14: fire
public function fire($hook, $parameters = [])
{
$hooks = Now::get('core.hooks', []);
$closure = isAke($hooks, $hook, null);
if ($closure) {
return call_user_func_array($closure, $parameters);
}
return null;
}
示例15: forget
public static function forget($class, $key = null)
{
$key = is_null($key) ? sha1($class) : $key;
$classInstances = isAke(static::$instances, $class);
$keyInstance = isAke($classInstances, $key, null);
if (!is_null($keyInstance)) {
unset(static::$instances[$class][$key]);
}
}