本文整理汇总了PHP中ArrayIterator::current方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayIterator::current方法的具体用法?PHP ArrayIterator::current怎么用?PHP ArrayIterator::current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayIterator
的用法示例。
在下文中一共展示了ArrayIterator::current方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
/**
*
* @param <type> $table
* @param ArrayIterator $params
* @return ArrayObject
*/
public function search($table, ArrayIterator $params)
{
$this->searchParams = $params;
$this->join();
if ($table == "analysis") {
$this->statements->remove("type_event");
}
$statement = "SELECT this_.* " . $this->selectAttributes() . " FROM {$table} this_ ";
$statement .= $this->join();
$i = 0;
$this->searchParams->rewind();
if ($this->searchParams->count() > 0 && !$this->searchParams->offsetExists('true')) {
$statement .= " WHERE ";
}
while ($this->searchParams->valid()) {
if ($this->statements->containsKey($this->searchParams->key())) {
if ($i++ > 0) {
$statement .= " AND ";
}
$clause = $this->statements->get($this->searchParams->key());
$statement .= str_replace(":" . $this->searchParams->key(), "'" . $this->searchParams->current() . "'", $clause['where']);
}
$this->searchParams->next();
}
return $this->getObject($statement . " ORDER BY this_.date DESC, this_.id DESC");
}
示例2: leaf
static function create_tree(ArrayIterator &$it)
{
if (!in_array($it->current()["term"], self::operators_dictionary)) {
$leaf = new leaf($it->current());
$it->next();
return $leaf;
} else {
if ($it->current()["term"] == "not") {
$it->next();
$op = self::create_tree($it);
return new notEx($op);
} else {
if ($it->current()["term"] == "and") {
$it->next();
$left = self::create_tree($it);
$right = self::create_tree($it);
return new andEx($left, $right);
} else {
if ($it->current()["term"] == "or") {
$it->next();
$left = self::create_tree($it);
$right = self::create_tree($it);
return new orEx($left, $right);
}
}
}
}
return null;
}
示例3: onResponse
/**
* Switches to alternate nicks as needed when nick collisions occur.
*
* @return void
*/
public function onResponse()
{
// If no alternate nick list was found, return
if (empty($this->iterator)) {
return;
}
// If the response event indicates that the nick set is in use...
$code = $this->getEvent()->getCode();
if ($code == Phergie_Event_Response::ERR_NICKNAMEINUSE) {
// Attempt to move to the next nick in the alternate nick list
$this->iterator->next();
// If another nick is available...
if ($this->iterator->valid()) {
// Switch to the new nick
$altNick = $this->iterator->current();
$this->doNick($altNick);
// Update the connection to reflect the nick change
$this->getConnection()->setNick($altNick);
} else {
// If no other nicks are available...
// Terminate the connection
$this->doQuit('All specified alternate nicks are in use');
}
}
}
示例4: key
/**
* @return NormalizedProduction|null
*/
public function key()
{
if ($this->innerIterator->valid()) {
/** @var LookAheadSetEntry $entry */
$entry = $this->innerIterator->current();
return $entry->getKey();
}
return null;
}
示例5: current
/**
* {@inheritdoc}
*/
public function current()
{
$current = $this->iterator->current();
$data = array();
foreach ($this->propertyPaths as $name => $propertyPath) {
$data[$name] = $this->getValue($this->propertyAccessor->getValue($current, $propertyPath));
}
return $data;
}
示例6: dayInfo
private function dayInfo()
{
$this->daysInfo = new ArrayIterator();
while ($this->days->valid()) {
$day = explode(") - ", $this->days->current());
$infos = explode("/", $day[1]);
$this->daysInfo->append($this->buildWeatherDayInfo($day[0], $infos));
$this->days->next();
}
}
示例7: current
/**
* get current testable object from collection
*
* @return \PhpUnitTestGenerator\Testable\Object
*/
public function current()
{
$f = $this->fileList->current();
if (is_file($f)) {
$object = Builder::buildTestableObjectFromFile($f);
/* @var $object \PhpUnitTestGenerator\Testable\Object */
return $object;
}
return null;
}
示例8: read
/**
* {@inheritdoc}
*/
public function read()
{
if (!$this->isExecuted) {
$this->isExecuted = true;
$this->results = $this->getResults();
}
if (null !== ($result = $this->results->current())) {
$this->results->next();
$this->stepExecution->incrementSummaryInfo('read');
}
return $result;
}
示例9: read
/**
* {@inheritdoc}
*/
public function read()
{
if (null === $this->results) {
$items = $this->readItems();
$this->results = new \ArrayIterator($items);
}
if (null !== ($result = $this->results->current())) {
$this->results->next();
$this->stepExecution->incrementSummaryInfo('read');
}
return $result;
}
示例10: buildMany
/**
* @param $fixtureType
* @param FixtureBuilder $builder
* @param array $entities
* @param string $hook
* @return array
* @throws UndefinedFixtureModel
*/
public static function buildMany($fixtureType, FixtureBuilder $builder, array $entities, $hook = '')
{
$many = [];
$iterator = new \ArrayIterator($entities);
while ($iterator->valid()) {
$builder->throwUndefinedDataProvider($iterator->current());
$fixtureId = self::_buildAndRegisterFixture($fixtureType, $hook, $iterator->current());
$many[] = self::_getMagentoModel($iterator->current(), $fixtureId);
$iterator->next();
}
return $many;
}
示例11: proceed
/**
* {@inheritDoc}
*/
public function proceed(CommandMessageInterface $commandProceedWith = null)
{
if (null !== $commandProceedWith) {
$this->command = $commandProceedWith;
}
if ($this->chain->valid()) {
$next = $this->chain->current();
$this->chain->next();
return $next->handle($this->command, $this->unitOfWork, $this);
} else {
return $this->handler->handle($this->command, $this->unitOfWork);
}
}
示例12: getValuesFromData
private function getValuesFromData(ArrayIterator $dataValues)
{
$values = array();
while ($dataValues->valid()) {
if ($dataValues->current() instanceof Data) {
array_push($values, $dataValues->current()->getValue());
}
$dataValues->next();
}
if (sizeof($values) > 0) {
return new ArrayIterator($values);
}
return $dataValues;
}
示例13: testSeek
function testSeek()
{
$iterator = new ArrayIterator([0, 5, 2, 6]);
$iterator->rewind();
$iterator->seek(3);
$this->assertEquals(6, $iterator->current());
$iterator->seek(1);
$this->assertEquals(5, $iterator->current());
$iterator->seek(2);
$this->assertEquals(2, $iterator->current());
$iterator->seek(0);
$this->assertEquals(0, $iterator->current());
$iterator->seek(3);
$this->assertEquals(6, $iterator->current());
}
示例14: buildLinesHtml
public static function buildLinesHtml(ArrayIterator $cot, $anotherType = null)
{
$html = "";
while ($cot->valid()) {
$html .= "<tr id='" . $cot->current()->getCode() . "' class='cotation-values'>";
if ($anotherType == null) {
$html .= self::buildLineWithCurrent($cot->current());
} else {
$html .= self::buildLineWithCurrentFisicaOrIndicador($cot->current(), $anotherType);
}
$html .= "</tr>";
$cot->next();
}
return $html;
}
示例15: current
/**
* Return the current resource.
*
* @return \com\mohiva\common\io\Resource The current `Resource` object or null if no resource
* exists.
*/
public function current()
{
if (!$this->valid()) {
return null;
}
return $this->iterator->current();
}