{@inheritDoc}
public static from ( $elements, Pinq\Iterators\IIteratorScheme $scheme = null, |
||
$scheme | Pinq\Iterators\IIteratorScheme | |
$source |
/** * @param string $basePath * @return Collection */ public function extractPaths(string $basePath) : Collection { if (is_dir($basePath)) { return Collection::from(glob($basePath . '/*.md')); } else { return Collection::from([$basePath]); } }
/** * @expectedException \Exception * @expectedExceptionMessage Serialization of 'Closure' is not allowed */ public function testThatCollectionIsNotSerializableAfterQueriesWithClosures() { $collection = Collection::from(range(1, 10)); $collection = $collection->where(function ($i) { return $i !== false; }); serialize($collection); }
protected function retrieveValues(\PDOStatement $statement) { $statement->setFetchMode(\PDO::FETCH_ASSOC); switch ($this->retrievalMode) { case Values::AS_ARRAY: return $statement->fetchAll(); case Values::AS_ARRAY_COMPATIBLE_ITERATOR: return new \IteratorIterator($statement); case Values::AS_TRUE_ITERATOR: return new \IteratorIterator($statement); case Values::AS_TRAVERSABLE: return Traversable::from($statement); case Values::AS_COLLECTION: return Collection::from($statement); default: throw new PinqDemoSqlException('Unsupported value retrieval mode'); } }