Puli\Repository\Resource\Iterator\ResourceCollectionIterator::current PHP Метод

current() публичный Метод

Returns the current value of the iterator.
public current ( ) : Puli\Repository\Api\Resource\PuliResource | string
Результат Puli\Repository\Api\Resource\PuliResource | string The current value as configured in {@link __construct}.
    public function current()
    {
        if ($this->mode & self::CURRENT_AS_RESOURCE) {
            return current($this->resources);
        }
        if ($this->mode & self::CURRENT_AS_PATH) {
            return current($this->resources)->getPath();
        }
        return current($this->resources)->getName();
    }

Usage Example

Пример #1
0
 /**
  * {@inheritdoc}
  *
  * @internal
  */
 public function dir_readdir()
 {
     if (!$this->childIterator->valid()) {
         return false;
     }
     $name = $this->childIterator->current();
     $this->childIterator->next();
     return $name;
 }