本文整理汇总了PHP中SplObjectStorage::getInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP SplObjectStorage::getInfo方法的具体用法?PHP SplObjectStorage::getInfo怎么用?PHP SplObjectStorage::getInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplObjectStorage
的用法示例。
在下文中一共展示了SplObjectStorage::getInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSubscriptionStateChange
/**
* Triggers PERSIST_INPUT_ERROR events for all currently active inputs
*/
public function onSubscriptionStateChange()
{
foreach ($this->_inputErrorCollection as $input) {
/* @var Input $input */
$this->handleInputErrors($input, $this->_inputErrorCollection->getInfo());
}
}
示例2: refreshQueue
/**
* 刷新监听者队列
*/
protected function refreshQueue()
{
$this->storage->rewind();
$this->queue = new \SplPriorityQueue();
foreach ($this->storage as $listener) {
$priority = $this->storage->getInfo();
$this->queue->insert($listener, $priority);
}
}
示例3: getAllFiles
/**
* @return RangeFile[]
*/
private function getAllFiles()
{
$all = [];
$this->map->rewind();
while ($this->map->valid() === true) {
array_push($all, $this->map->getInfo());
$this->map->next();
}
return $all;
}
示例4: findByName
/**
* @param string $name
* @return bool|ConfigurationInterface
*/
protected function findByName($name)
{
$this->connections->rewind();
while ($this->connections->valid()) {
if ($this->connections->getInfo() === $name) {
return $this->connections->current();
}
$this->connections->next();
}
return false;
}
示例5: all
/**
* @param array $categories
*
* @return HandlerInterface[]
*/
public function all(array $categories = array())
{
$handlers = array();
foreach ($this->handlers as $handler) {
$handlerCategories = $this->handlers->getInfo();
if (array() === $categories || array() !== array_intersect($handlerCategories, $categories)) {
$handlers[] = $handler;
}
}
return $handlers;
}
示例6: remove
/**
* 删除一个监听器
* @param $listener
* @return $this
*/
public function remove($listener)
{
if ($this->has($listener)) {
$this->store->detach($listener);
$this->store->rewind();
$queue = new \SplPriorityQueue();
foreach ($this->store as $listener) {
// 优先级
$priority = $this->store->getInfo();
$queue->insert($listener, $priority);
}
$this->queue = $queue;
}
return $this;
}
示例7: getControlEntityClass
/**
* @param \Nette\Forms\IControl|\Nette\Forms\Controls\BaseControl $control
*
* @return object
*/
protected function getControlEntityClass(Nette\Forms\IControl $control)
{
foreach ($this->entities as $entity) {
if ($this->entities->getInfo() === $control->getParent()) {
return $this->getTargetClassName($entity, $this->getControlField($control));
}
}
return NULL;
}
示例8: eventsToPublish
private function eventsToPublish()
{
$events = array();
$this->eventsToPublish->rewind();
while ($this->eventsToPublish->valid()) {
$events = array_merge($events, $this->eventsToPublish->getInfo());
$this->eventsToPublish->next();
}
return $events;
}
示例9: commit
/**
* @param null|mixed|array $models (optional)
*/
public function commit($models = null)
{
$pool = $this->manager->getPool();
/** @var ObjectManager[] $managers */
$managers = $pool->getIterator();
if (null === $models) {
foreach ($managers as $manager) {
$manager->flush();
}
if (!$this->models->count()) {
return;
}
$this->models->rewind();
while ($this->models->valid()) {
$model = $this->models->current();
$class = $this->manager->getClassMetadata(get_class($model));
$managerName = $class->getManagerReferenceGenerator();
$ref = call_user_func(array($model, 'get' . ucfirst($managerName)));
$id = call_user_func(array($ref, 'get' . ucfirst($class->getIdentifierReference($managerName)->referenceField)));
foreach ($this->models->getInfo() as $managerName) {
$this->saveSpecificModel($model, $managerName, $id);
}
$this->models->next();
}
// clear list
$this->models = new \SplObjectStorage();
} else {
if (!is_array($models)) {
$models = array($models);
}
foreach ($models as $model) {
$class = $this->manager->getClassMetadata(get_class($model));
$managerName = $class->getManagerReferenceGenerator();
$ref = call_user_func(array($model, 'get' . ucfirst($managerName)));
$pool->getManager($managerName)->flush($ref);
$id = call_user_func(array($ref, 'get' . ucfirst($class->getIdentifierReference($managerName)->referenceField)));
foreach ($class->getFieldManagerNames() as $managerName) {
$this->saveSpecificModel($model, $managerName, $id);
}
}
}
}
示例10: run
/**
* Run current callback in the pipeline.
*
* @param $initial
* @param $carry
* @return mixed
*/
private function run($initial, $carry)
{
/** @var callable $callback */
$callback = $this->pipeline->current();
/** @var array $args */
$args = $this->pipeline->getInfo();
array_unshift($args, $this->DTOs->top());
array_unshift($args, $initial);
array_unshift($args, $carry);
return $this->maybeCast(call_user_func_array($callback, $args));
}
示例11: getEdgeSet
/**
* Get the edges set
*
* @return Edge[]
*/
public function getEdgeSet()
{
$set = array();
foreach ($this->adjacency as $vertex) {
$edgeList = $this->adjacency->getInfo();
foreach ($edgeList as $item) {
$set[] = $edgeList->getInfo();
}
}
return $set;
}
示例12: castObjectStorage
public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, $isNested)
{
$storage = array();
unset($a[Caster::PREFIX_DYNAMIC . "gcdata"]);
// Don't hit https://bugs.php.net/65967
foreach ($c as $obj) {
$storage[spl_object_hash($obj)] = array('object' => $obj, 'info' => $c->getInfo());
}
$a += array(Caster::PREFIX_VIRTUAL . 'storage' => $storage);
return $a;
}
示例13: createParser
public function createParser($name)
{
$signatures =& self::$signatures;
$signatures = new \SplObjectStorage();
$class = "class {$name} {\n" . "public \$length;\n" . 'public function parse($input) {' . '$this -> length = strlen($input);' . '$input .= "\\0";' . '$pos = 0;' . 'return [' . $this . ', $pos, $this -> length];' . "}\n";
foreach ($signatures as $signature) {
list($id, $code) = $signatures->getInfo();
$class .= 'public function _' . $id . '($input, &$pos) {' . $code . '}' . "\n";
}
$class .= '}';
return $class;
}
示例14: getEigenVectorSparse
/**
* Return the dominant eigenvector of the adjacency matrix of
* this graph
*
* @param float $precision
* @return \SplObjectStorage
*/
public function getEigenVectorSparse($precision = 0.001)
{
$vertex = $this->getVertexSet();
$dimension = count($vertex);
$approx = new \SplObjectStorage();
foreach ($vertex as $v) {
$approx[$v] = 1 / sqrt($dimension);
}
$iter = 0;
do {
// result = M . approx
$result = new \SplObjectStorage();
foreach ($vertex as $v) {
$result[$v] = 0;
}
foreach ($vertex as $v) {
foreach ($this->graph->getSuccessor($v) as $succ) {
$result[$v] += $approx[$succ];
// very suspicious
// what if we invert $v and $succ, isn't the reversed digraph ?
}
}
// calc the norm
$sum = 0;
foreach ($result as $v) {
$sum += $result->getInfo() * $result->getInfo();
}
$norm = sqrt($sum);
$delta = 0;
// normalize
foreach ($result as $v) {
$newVal = $norm > 0 ? $result->getInfo() / $norm : 0;
$delta += abs($newVal - $approx[$v]);
$approx[$v] = $newVal;
}
$iter++;
} while ($delta > $precision && $iter < 2 * $dimension);
return array('value' => $norm, 'vector' => $approx);
}
示例15: getSessionBySessionId
/**
* Get session by session ID
*
* @param int $sessionId
* @return \Thruway\Session|boolean
*/
public function getSessionBySessionId($sessionId)
{
/** @var Session $session */
$this->sessions->rewind();
while ($this->sessions->valid()) {
$session = $this->sessions->getInfo();
if ($session->getSessionId() == $sessionId) {
return $session;
}
$this->sessions->next();
}
return false;
}