mirror of
https://github.com/getgrav/grav.git
synced 2025-10-26 00:46:07 +02:00
I fixed some small inconsistencies here and there. There are still a little over 200 to go. This time against the 1.7 branch. To try it, checkout this PR and run: composer require phan/phan It doesn't have to be in the Grav tree. You can install it anywhere. Then from the top-level Grav dir: /vendor/bin/phan -p You can see the ones that are left to address here: https://gist.github.com/69eac9b37ced1cadc08ed4be0ee84f40 Also, and the main reason I added it, was to get some nice dependency graphs from Phan to help me understand the Grav code. Some examples: http://pdep.lerdorf.com/?mode=class&node=\Grav\Common\File\CompiledFile&d=3 http://pdep.lerdorf.com/?mode=class&node=\Grav\Common\Filesystem\Folder&d=1 http://pdep.lerdorf.com/?mode=class&node=\Doctrine\Common\Cache\Cache&d=2 http://pdep.lerdorf.com/?mode=class&node=\RocketTheme\Toolbox\ArrayTraits\Export&d=1 Move the slider to change the number of dependency levels shown.
140 lines
4.4 KiB
PHP
140 lines
4.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* @package Grav\Framework\Flex
|
|
*
|
|
* @copyright Copyright (C) 2015 - 2019 Trilby Media, LLC. All rights reserved.
|
|
* @license MIT License; see LICENSE file for details.
|
|
*/
|
|
|
|
namespace Grav\Framework\Flex\Interfaces;
|
|
|
|
use Grav\Framework\Flex\Flex;
|
|
use Grav\Framework\Object\Interfaces\NestedObjectInterface;
|
|
use Grav\Framework\Object\Interfaces\ObjectCollectionInterface;
|
|
use Grav\Framework\Flex\FlexDirectory;
|
|
|
|
/**
|
|
* Defines a collection of Flex Objects.
|
|
*
|
|
* @used-by \Grav\Framework\Flex\FlexCollection
|
|
* @since 1.6
|
|
*/
|
|
interface FlexCollectionInterface extends FlexCommonInterface, ObjectCollectionInterface, NestedObjectInterface
|
|
{
|
|
/**
|
|
* Creates a Flex Collection from an array.
|
|
*
|
|
* @used-by FlexDirectory::createCollection() Official method to create a Flex Collection.
|
|
*
|
|
* @param FlexObjectInterface[] $entries Associated array of Flex Objects to be included in the collection.
|
|
* @param FlexDirectory $directory Flex Directory where all the objects belong into.
|
|
* @param ?string $keyField Key field used to index the collection.
|
|
*
|
|
* @return static Returns a new Flex Collection.
|
|
*/
|
|
public static function createFromArray(array $entries, FlexDirectory $directory, string $keyField = null);
|
|
|
|
/**
|
|
* Creates a new Flex Collection.
|
|
*
|
|
* @used-by FlexDirectory::createCollection() Official method to create Flex Collection.
|
|
*
|
|
* @param FlexObjectInterface[] $entries Associated array of Flex Objects to be included in the collection.
|
|
* @param ?FlexDirectory $directory Flex Directory where all the objects belong into.
|
|
*
|
|
* @throws \InvalidArgumentException
|
|
*/
|
|
public function __construct(array $entries = [], FlexDirectory $directory = null);
|
|
|
|
/**
|
|
* Search a string from the collection.
|
|
*
|
|
* @param string $search Search string.
|
|
* @param string|string[]|null $properties Properties to search for, defaults to configured properties.
|
|
* @param array|null $options Search options, defaults to configured options.
|
|
*
|
|
* @return FlexCollectionInterface Returns a Flex Collection with only matching objects.
|
|
* @api
|
|
*/
|
|
public function search(string $search, $properties = null, array $options = null);
|
|
|
|
/**
|
|
* Sort the collection.
|
|
*
|
|
* @param array $orderings Pair of [property => 'ASC'|'DESC', ...].
|
|
*
|
|
* @return FlexCollectionInterface Returns a sorted version from the collection.
|
|
*/
|
|
public function sort(array $orderings);
|
|
|
|
/**
|
|
* Filter collection by filter array with keys and values.
|
|
*
|
|
* @param array $filters
|
|
* @return FlexCollectionInterface
|
|
*/
|
|
public function filterBy(array $filters);
|
|
|
|
/**
|
|
* Get timestamps from all the objects in the collection.
|
|
*
|
|
* This method can be used for example in caching.
|
|
*
|
|
* @return int[] Returns [key => timestamp, ...] pairs.
|
|
*/
|
|
public function getTimestamps(): array;
|
|
|
|
/**
|
|
* Get storage keys from all the objects in the collection.
|
|
*
|
|
* @see FlexDirectory::getObject() If you want to get Flex Object from the Flex Directory.
|
|
*
|
|
* @return string[] Returns [key => storage_key, ...] pairs.
|
|
*/
|
|
public function getStorageKeys(): array;
|
|
|
|
/**
|
|
* Get Flex keys from all the objects in the collection.
|
|
*
|
|
* @see Flex::getObjects() If you want to get list of Flex Objects from any Flex Directory.
|
|
*
|
|
* @return string[] Returns[key => flex_key, ...] pairs.
|
|
*/
|
|
public function getFlexKeys(): array;
|
|
|
|
/**
|
|
* Return new collection with a different key.
|
|
*
|
|
* @param string|null $keyField Switch key field of the collection.
|
|
*
|
|
* @return FlexCollectionInterface Returns a new Flex Collection with new key field.
|
|
* @api
|
|
*/
|
|
public function withKeyField(string $keyField = null);
|
|
|
|
/**
|
|
* Get Flex Index from the Flex Collection.
|
|
*
|
|
* @return FlexIndexInterface Returns a Flex Index from the current collection.
|
|
*/
|
|
public function getIndex();
|
|
|
|
/**
|
|
* Load all the objects into memory,
|
|
*
|
|
* @return FlexCollectionInterface
|
|
*/
|
|
public function getCollection();
|
|
|
|
/**
|
|
* Get metadata associated to the object
|
|
*
|
|
* @param string $key Key.
|
|
* @return array
|
|
*/
|
|
public function getMetaData(string $key): array;
|
|
}
|