Get the stream projection

@param   array   $projections    Projection of query
@return  boolean
775454
private function getStreamProjection($projections)
    {
        if (isset($projections['stream'])) {
            return $projections['stream'];
        } elseif (empty($projections)) {
            return true;
        } else {
            if (isset($projections['_id'])) {
                unset($projections['_id']);
            }
            return reset($projections) ? false : true;
        }
    }
71963
public function search(array $filters)
    {
        return $this->filter(function (CollectionableInterface $entity) use ($filters) {
            $res = true;
            foreach ($filters as $key => $value) {
                $current = $this->getPropertyAccessor()->getValue($entity, $key);
                $res = $res && (is_array($value) ?
                    in_array($current, $value) :
                    $current == $value
                );
            }

            return $res;
        });
    }
871340
public function transform($relations = false)
    {
        $relations = $relations ? Config::get('larasearch.paths.' . get_class($this)) : [];

        $doc = $this->load($relations)->toArray();

        return $doc;
    }
1134423
protected function fetchStreams(array $pipes)
    {
        $output  = $this->colorize(stream_get_contents($pipes[2]), '%r');
        $output .= $this->colorize(stream_get_contents($pipes[1]), '%g');

        return $output;
    }
1332096
public static function get(array $array, ...$keys)
    {
        $key = array_shift($keys);

        if (!isset($array[$key])) {
            return null;
        }

        if (empty($keys)) {
            return $array[$key] ?? null;
        }

        if (!\is_array($array[$key])) {
            return null;
        }

        return self::get($array[$key], ...$keys);
    }
477558
public static function hydrateCollection(array $applications)
    {
        $hydrated = [];

        foreach ($applications as $application) {
            $hydrated[] = self::hydrate($application);
        }

        return $hydrated;
    }
862640
public function getQuery(array $options = array())
    {
        if ($this->query['type'] === Query::TYPE_MAP_REDUCE) {
            $this->hydrate = false;
        }

        $documentPersister = $this->dm->getUnitOfWork()->getDocumentPersister($this->class->name);

        $query = $this->query;

        $query['query'] = $this->expr->getQuery();
        $query['query'] = $documentPersister->addDiscriminatorToPreparedQuery($query['query']);
        $query['query'] = $documentPersister->addFilterToPreparedQuery($query['query']);

        $query['newObj'] = $this->expr->getNewObj();

        if (isset($query['select'])) {
            $query['select'] = $documentPersister->prepareSortOrProjection($query['select']);
        }

        if (isset($query['sort'])) {
            $query['sort'] = $documentPersister->prepareSortOrProjection($query['sort']);
        }

        if ($this->class->slaveOkay) {
            $query['slaveOkay'] = $this->class->slaveOkay;
        }

        return new Query(
            $this->dm,
            $this->class,
            $this->collection,
            $query,
            $options,
            $this->hydrate,
            $this->refresh,
            $this->primers,
            $this->requireIndexes
        );
    }
632204
public function hasMany(array $keys)
    {
        $values = $this->getMany($keys);

        return array_map(function ($value) {
            return ! is_null($value);
        }, $values);
    }
498078
public static function handleStream($segments) {

		$page = array_shift($segments);
		$guid = array_shift($segments);

		switch ($page) {

			case 'comments' :

				$comment_guid = array_shift($segments);
				set_input('entity_guid', $guid);
				set_input('comment_guid', $comment_guid);
				echo elgg_view_resource('interactions/comments', [
					'guid' => $guid,
					'comment_guid' => $comment_guid
				]);
				return true;

			case 'likes' :
				set_input('guid', $guid);
				echo elgg_view_resource('interactions/likes', [
					'guid' => $guid,
				]);
				return true;

			case 'edit' :
				set_input('guid', $guid);
				echo elgg_view_resource('interactions/edit', [
					'guid' => $guid,
				]);
				return true;

			case 'view' :
				set_input('guid', $guid);
				echo elgg_view_resource('interactions/view', [
					'guid' => $guid,
				]);
				return true;
		}

		return false;
	}
1252768
public function stream_cast($castAs)
    {
        if ($this->fileHandle !== null && $castAs & STREAM_CAST_AS_STREAM) {
            return $this->fileHandle;
        } else {
            return false;
        }
    }
1150597
protected static function query($fields)
    {
        $result = Query::from(static::$table);

        $result = $result->where();

        foreach ($fields as $key => $value) {
            $result = $result->andWhere($key, '=', $value);
        }

        return $result->get();
    }
553614
public function load(array $paths)
    {
        $finder = new Finder();
        $finder->in($paths);
        $finder->name('*Fixture.php');

        foreach ($finder as $file) {
            $declaredClasses = get_declared_classes();
            require_once $file;
            $declaredClassesDiff = array_diff(get_declared_classes(), $declaredClasses);
            $fixtureClass = array_pop($declaredClassesDiff);

            if (!$fixtureClass) {
                throw new \InvalidArgumentException(sprintf(
                    'Could not determine class from included file "%s". Class detection will only work once per request.',
                    $file
                ));
            }

            $refl = new \ReflectionClass($fixtureClass);

            if ($refl->isAbstract()) {
                continue;
            }

            if (false === $refl->isSubclassOf(DocumentFixtureInterface::class)) {
                continue;
            }

            $fixture = new $fixtureClass();

            if ($fixture instanceof ContainerAwareInterface) {
                $fixture->setContainer($this->container);
            }

            $fixtures[] = $fixture;
        }

        usort($fixtures, function(DocumentFixtureInterface $fixture1, DocumentFixtureInterface $fixture2) {
            return $fixture1->getOrder() > $fixture2->getOrder();
        });

        return $fixtures;
    }
487489
final public function getQuery(array $parameters = [])
    {
        $parameters = $this->getOptionsResolver()->resolve($parameters);
        $query = $this->buildQuery();

        $sortDefinitions = $parameters['sort'];
        if (!is_array($sortDefinitions)) {
            $sortDefinitions = [$sortDefinitions];
        }

        $query->query = $this->getQueryCriterion($parameters);
        $query->filter = $this->resolveFilterCriteria($parameters);
        $query->facetBuilders = $this->getFacetBuilders($parameters);
        $query->sortClauses = $this->getSortClauses($sortDefinitions);
        $query->limit = $parameters['limit'];
        $query->offset = $parameters['offset'];

        return $query;
    }
94701
protected function getStream($contents)
    {
        if ($this->isPipe($contents)) {
            /* @var resource $contents */
            return new PumpStream(function ($length) use ($contents) {
                $data = fread($contents, $length);
                if (strlen($data) === 0) {
                    return false;
                }

                return $data;
            });
        }

        return Psr7\stream_for($contents);
    }
694263
public function lookup(array $queries = array())
    {
        try {
            $request  = $this->requestLookup($queries);
            $response = $this->getClient()->send($request);
        } catch(\Exception $ex) {
            throw new \RuntimeException('Failed to get response', 0, $ex);
        }

        // if success level, 
        if(2 == floor($response->getStatusCode()/100)) {
            $contentType = $response->getHeader('Content-Type');

            switch($contentType) {
            case 'application/json':
                return $response->json();
            case 'application/xml':
                return $response->xml();
            default:
                //throw new UnsupportedFormatException(sprintf('Content-Type "%s" is not supported.', $response->getHeader('Content-Type')));
                throw new \RuntimeException(sprintf('Content-Type "%s" is not supported.', $contentType));
            }
        }

        throw new \RuntimeException(sprintf('Failed to get the response: StatusCode [%d]', $response->getStatusCode()));
    }
1352734
public static function point(array $bounds = null)
    {
        if ($bounds === null) {
            $bounds = static::bounds();
        }

        return array(
            self::LAT => self::randFloat(self::latRange($bounds)),
            self::LNG => self::randFloat(self::lngRange($bounds)),
        );
    }
160546
public function hasStream($stream)
    {
        $isInputStream = $stream == $this->getInputStream();
        $isOutputStream = $stream == $this->getOutputStream();
        $isErrStream = $stream == $this->getErrorStream();

        return $isInputStream || $isOutputStream || $isErrStream;
    }