1: <?php declare(strict_types=1);
2:
3: namespace Salient\Contract\Core;
4:
5: use Salient\Contract\Container\ServiceAwareInterface;
6: use Salient\Contract\Iterator\FluentIteratorInterface;
7:
8: /**
9: * Serviced by a provider
10: *
11: * @template TProvider of ProviderInterface
12: * @template TContext of ProviderContextInterface
13: *
14: * @extends ProviderAwareInterface<TProvider>
15: * @extends ProviderContextAwareInterface<TContext>
16: */
17: interface Providable extends
18: ProviderAwareInterface,
19: ServiceAwareInterface,
20: ProviderContextAwareInterface
21: {
22: /**
23: * Create an instance of the class from an array on behalf of a provider
24: *
25: * @param mixed[] $data
26: * @param TProvider $provider
27: * @param TContext|null $context
28: * @return static
29: */
30: public static function provide(
31: array $data,
32: ProviderInterface $provider,
33: ?ProviderContextInterface $context = null
34: );
35:
36: /**
37: * Create instances of the class from arrays on behalf of a provider
38: *
39: * @param iterable<array-key,mixed[]> $list
40: * @param TProvider $provider
41: * @param ListConformity::* $conformity
42: * @param TContext|null $context
43: * @return FluentIteratorInterface<array-key,static>
44: */
45: public static function provideList(
46: iterable $list,
47: ProviderInterface $provider,
48: $conformity = ListConformity::NONE,
49: ?ProviderContextInterface $context = null
50: ): FluentIteratorInterface;
51:
52: /**
53: * Called after data from the provider has been applied to the object
54: */
55: public function postLoad(): void;
56: }
57: