本文整理汇总了PHP中Builder::populatePersonsType方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::populatePersonsType方法的具体用法?PHP Builder::populatePersonsType怎么用?PHP Builder::populatePersonsType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Builder
的用法示例。
在下文中一共展示了Builder::populatePersonsType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AMQPConnection
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Formatter\LineFormatter;
//Parsing the config file
$yml = Yaml::parse(file_get_contents("config.yml"), false, false, true);
$config = json_decode(json_encode($yml));
$connection = new AMQPConnection($config->rabbitmq->host, $config->rabbitmq->port, $config->rabbitmq->user, $config->rabbitmq->pass);
$channel = $connection->channel();
$channel->queue_declare('task_queue', false, true, false, false);
echo "[*] Worker ready! CRTL+C to quit\n";
$callback = function ($message) {
$demande = json_decode($message->body);
//Getting a slice of users
$builder = new Builder();
if ('PSR' == $demande->type) {
$builder->populatePersonsType($demande->start, $demande->maxEntries);
}
$message->delivery_info['channel']->basic_ack($message->delivery_info['delivery_tag']);
//Log the processing (because we can)
$log = new Logger('IndexLog');
$stream = new StreamHandler('log/indexer.log', Logger::DEBUG);
$stream->setFormatter(new LineFormatter("%datetime% > %level_name% > %message%\n", "Y-m-d H:i:s"));
$log->pushHandler($stream);
$log->addDebug(sprintf("Indexing %s, slice %d/%d", $demande->type, $demande->start / $demande->maxEntries + 1, $demande->total / $demande->maxEntries + 1));
};
$channel->basic_qos(null, 1, null);
$channel->basic_consume('task_queue', '', false, false, false, false, $callback);
while (count($channel->callbacks)) {
$channel->wait();
}
$channel->close();