本文整理汇总了PHP中Scalr::camelize方法的典型用法代码示例。如果您正苦于以下问题:PHP Scalr::camelize方法的具体用法?PHP Scalr::camelize怎么用?PHP Scalr::camelize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scalr
的用法示例。
在下文中一共展示了Scalr::camelize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: camelize
/**
* Camelizes string
*
* @param string $input
* @return string Returns camelized string
*/
public function camelize($input)
{
return \Scalr::camelize($input);
}
示例2: set_time_limit
set_time_limit(0);
$opt = getopt('', ['name:']);
//10 KiB of emergency memory
Scalr::$emergencyMemory = str_repeat(' ', 10240);
if (empty($opt['name']) || !preg_match('/^[\\w]+(\\.|$)/', $opt['name'])) {
printf("Usage: worker.php --name=service [options]\n");
exit;
}
//Service name is expected
$service = $opt['name'];
//The name of the service might be composite (scalarizr_messaging.HostInit.655)
if (($dot = strpos($service, '.')) !== false) {
$cls = \Scalr::camelize(substr($service, 0, $dot));
} else {
//name of the class in camel case
$cls = \Scalr::camelize($service);
}
//Checking if task class exists.
if (!file_exists(SRCPATH . '/Scalr/System/Zmq/Cron/Task/' . $cls . '.php')) {
printf("Launch error. File %s does not exist.\n", SRCPATH . '/Scalr/System/Zmq/Cron/Task/' . $cls . '.php');
exit;
}
$taskClass = 'Scalr\\System\\Zmq\\Cron\\Task\\' . $cls;
/* @var $task \Scalr\System\Zmq\Cron\AbstractTask */
$task = new $taskClass();
$config = $task->config();
//Initializes MDP Worker
$worker = (new Worker(Scalr::config('scalr.crontab.sockets.broker'), $service, true))->setHeartbeat(Scalr::config('scalr.crontab.heartbeat.delay'))->setLiveness(Scalr::config('scalr.crontab.heartbeat.liveness'))->setLogger(\Scalr::getContainer()->logger('cron/worker.php')->setLevel(\Scalr::config('scalr.crontab.log_level')))->connect();
$interrupt = 0;
// Whether the worker lost connection to the broker.
$disconnected = false;
示例3: getServerHistory
/**
* Gets server history object
*
* @return \Scalr\Server\History Returns server history object
*/
public function getServerHistory()
{
$bSave = false;
$mapping = array('envId' => 'envId', 'farmId' => 'farmId', 'farmRoleid' => 'farmRoleId', 'serverIndex' => 'index', 'cloudLocation' => 'cloudLocation');
if (!isset($this->serverHistory)) {
$this->serverHistory = new \Scalr\Server\History();
$info = $this->Db->GetRow("\n SELECT * FROM servers_history WHERE server_id = ? LIMIT 1\n ", array($this->serverId));
if (!$info) {
$this->serverHistory->clientId = $this->clientId;
$this->serverHistory->serverId = $this->serverId;
$this->serverHistory->platform = $this->platform;
$this->serverHistory->cloudLocation = $this->cloudLocation;
foreach ($mapping as $prop => $key) {
$this->serverHistory->{$prop} = $this->{$key};
}
$bSave = true;
} else {
foreach ($info as $key => $value) {
$prop = lcfirst(\Scalr::camelize($key));
$this->serverHistory->{$prop} = $value;
if (array_key_exists($prop, $mapping)) {
if ($value != $this->{$mapping[$prop]}) {
$this->serverHistory->{$prop} = $this->{$mapping[$prop]};
$bSave = true;
}
}
}
}
if (!$this->serverHistory->cloudServerId) {
$this->serverHistory->cloudServerId = $this->GetCloudServerID();
$this->serverHistory->type = $this->GetFlavor();
$bSave = true;
}
} else {
foreach ($mapping as $prop => $key) {
if ($this->serverHistory->{$prop} != $this->{$key}) {
$this->serverHistory->{$prop} = $this->{$key};
$bSave = true;
}
}
}
if (!empty($bSave)) {
$this->serverHistory->save();
}
return $this->serverHistory;
}