Get an iterator that outputs locked thumbnail rows
@return \Generator|void
339187
public function getIterator()
    {
        $db = $this->manager->connection();
        // Make sure we have the proper columns before doing anything with SQL
        if (!$this->lockColumnsExist($db)) {
            return;
        }

        $qb = $db->createQueryBuilder();
        $nextQuery = $this->getNextQuery($qb);
        $try = 10;

        while ($next = $this->next($nextQuery)) {
            unset($next[$this->lockColumn]);
            unset($next[$this->lockTimeoutColumn]);
            if (!$this->reserveNext($next, $db)) {
                if ($try--) {
                    // Avoid infinite loop
                    break;
                }

                // We were unable to reserve this properly, lets try the next item instead.
                continue;
            }

            yield $next;
        }
    }
640477
public function locked()
    {
        $this->defaultData();
	    $resource = $this->getResource($this->getRequestParameter('id'));
	    $lockData = LockManager::getImplementation()->getLockData($resource);

	    $this->setData('topclass-label',
	        $this->hasRequestParameter('topclass-label') ? $this->getRequestParameter('topclass-label') : __('Resource')
        );

	    if (AclProxy::hasAccess($this->getSession()->getUser(), __CLASS__, 'forceRelease', array('uri' => $resource->getUri()))) {
	        $this->setData('id', $resource->getUri());
            $this->setData('forceRelease', true);
	    }

	    $this->setData('lockDate', $lockData->getCreationTime());
	    $this->setData('ownerHtml', UserHelper::renderHtmlUser($lockData->getOwnerId()));

	    if ($this->hasRequestParameter('view') && $this->hasRequestParameter('ext')) {
	        $this->setView($this->getRequestParameter('view'), $this->getRequestParameter('ext'));
	    } else {
	        $this->setView('Lock/locked.tpl', 'tao');
	    }
	}
1121990
public function getIterator() : iterable
    {
        foreach ($this->bufferedChanges as $change) {
            yield $change;
        }

        foreach ($this->unBufferedChanges ?? [] as $change) {
            $this->bufferedChanges[] = $change;

            yield $change;
        }

        $this->unBufferedChanges = null;
    }
423805
protected static function lock()
    {
        $fd = fopen(static::$_startFile, 'r');
        if (!$fd || !flock($fd, LOCK_EX)) {
            static::log("Workerman[".static::$_startFile."] already running");
            exit;
        }
    }
723586
public function PaginatedGalleries()
    {
        $children = $this->AllChildren();
        $limit = $this->ThumbnailsPerPage;
        $list = ArrayList::create();

        foreach ($children as $child) {
            $image = $child->SortedImages()->first();
            $child_data = $child->toMap();
            $child_data["Link"] = $child->Link();
            if ($image) {
                $child_data["GalleryThumbnail"] = $this->ScaledImage($image, true);
            } else {
                $child_data["GalleryThumbnail"] = null;
            }
            $list->add(ArrayData::create($child_data));
        }

        $pages = PaginatedList::create($list, $this->getRequest());
        $pages->setPageLength($limit);

        return $pages;
    }
759037
public function getIterator()
    {
        $this->reset();

        foreach ($this->iterator as $key => $value) {
            $this->position++;
            yield $key => $value;
        }
    }
795074
public function getIterator()
    {
        foreach ($this->rawIterator() as $data) {
            $this->data = $this->persistence->typecastLoadRow($this, $data);
            if ($this->id_field) {
                $this->id = isset($data[$this->id_field]) ? $data[$this->id_field] : null;
            }

            // you can return false in afterLoad hook to prevent to yield this data row
            // use it like this:
            // $model->addHook('afterLoad', function ($m) {
            //     if ($m['date'] < $m->date_from) $m->breakHook(false);
            // })

            // you can also use breakHook() with specific object which will then be returned
            // as a next iterator value

            $ret = $this->hook('afterLoad');

            if ($ret === false) {
                continue;
            }

            if (is_object($ret)) {
                if ($ret->id_field) {
                    yield $ret->id => $ret;
                } else {
                    yield $ret;
                }
            } else {
                if ($this->id_field) {
                    yield $this->id => $this;
                } else {
                    yield $this;
                }
            }
        }

        $this->unload();
    }
326579
public function getIterator()
    {
        //Run the query
        $resp = $this->query->execute();

        //Return the documents as an ArrayIterator to satisfy the requirements
        //of the getIterator function.
        foreach ($resp->data as $document)
        {
            yield $document;
        }

        while ($resp->cursors->next) {
            //send a new request, resetting $resp
            $resp = $this->query->execute($resp->cursors->next);

            foreach ($resp->data as $document)
            {
                yield $document;
            }
        }
    }
222351
public function getIterator()
    {
        $aResult = array();
        $iStart  = ($this->itemsPerPage * ($this->page - 1));
        if ($iStart < 0) {
            throw new \OutOfBoundsException('Start index cant no be lower then 1');
        }
        try {
            $iRestOfResults                    = ($this->itemsPerPage - 1);
            $mFirstValues                      = $this->collection->seek($iStart);
            $aResult[$this->collection->key()] = $mFirstValues;
            while ($iRestOfResults > 0) {
                $mValue = $this->collection->scNext();
                if ($mValue === AbstractCollection::NOT_SET_FLAG) {
                    throw new \OutOfBoundsException();
                }
                $aResult[$this->collection->key()] = $mValue;
                $iRestOfResults--;
            }

        } catch (\OutOfBoundsException $oException) {
            // do nothing, this exception is not critical
        }
        $sClassName = get_class($this->collection);

        return new $sClassName($aResult);
    }
539382
protected function lock() {

        $this->db->lockTable($this->getTable());
        $this->locked = true;

        return true;
    }
1288372
function getIterator()
    {
        // TODO improve iteration by pagination

        $realm = $this->getRealm();


        try {
            $sql = "SELECT * FROM `KVStore` WHERE `realm` = '$realm';";

            $stm = $this->pdo->prepare($sql);
            $stm->execute();
            $stm->setFetchMode(\PDO::FETCH_ASSOC);

            $c = $stm->fetchAll();

            foreach ($c as $d)
                yield $d['key'] => $this->getDataInterchange()->retrieveBackward( $d['value'] );

        } catch (\Exception $e) {
            throw new exReadError($e->getMessage(), $e->getCode(), $e);
        }
    }
1263927
public function getIterator() {
		if($this->loaded == false) {
			$this->items = $this->getReferences();
			$this->loaded = true;
		}
		foreach($this->items as $i => $item) {
			if(is_array($item)) $this->items[$i] = new ArrayData($item);
		}
		return new ArrayIterator($this->items);
	}
43225
public function getIterator()
    {
        // Return an iterator just like the old iteration of the HistoryPlugin for BC compatibility (use getAll())
        return new \ArrayIterator(array_map(function ($entry) {
            $entry['request']->getParams()->set('actual_response', $entry['response']);
            return $entry['request'];
        }, $this->transactions));
    }
646256
public function getLockData() {
		$json = \Pressbooks\Utility\get_contents( $this->getLockDir( false ) . '/lock.json' );
		$output = json_decode( $json, true );
		return $output;
	}
1006711
public function actionClearAllThumbnails()
    {
        /**
         * @var $files StorageFile[]
         */
        ini_set('memory_limit', '2048M');

        if ($files = StorageFile::find()->count()) {
            foreach (StorageFile::find()->orderBy(['id' => SORT_ASC])->each(100) as $file) {
                $this->stdout("{$file->id}");
                if ($file->deleteTmpDir()) {
                    $this->stdout(" - true\n", Console::FG_GREEN);
                } else {
                    $this->stdout(" - false\n", Console::FG_RED);
                }
            }
        }
    }
264761
public function getIterator(): \Generator
    {
        while (!$this->stream->eof()) {
            $item = $this->stream->read($this->chunkSize);
            // @codeCoverageIgnoreStart
            //I don't know how to fabricate this manually, so I can't test it.
            if ($item === '') {
                continue;
            }
            // @codeCoverageIgnoreEnd
            yield $item;
        }
    }
262282
public function isOverlapping()
    {
        return $this->lockFile &&
            file_exists($this->lockFile) &&
            call_user_func($this->whenOverlapping, filemtime($this->lockFile)) === false;
    }