1: <?php
2: /**
3: * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
4: * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
5: *
6: * Licensed under The MIT License
7: * For full copyright and license information, please see the LICENSE.txt
8: * Redistributions of files must retain the above copyright notice.
9: *
10: * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
11: * @link https://cakephp.org CakePHP(tm) Project
12: * @since 3.1.0
13: * @license https://opensource.org/licenses/mit-license.php MIT License
14: */
15: namespace Cake\ORM\Locator;
16:
17: use Cake\ORM\Table;
18:
19: /**
20: * Registries for Table objects should implement this interface.
21: *
22: * @method array getConfig($alias)
23: * @method $this setConfig($alias, $options = null)
24: */
25: interface LocatorInterface
26: {
27:
28: /**
29: * Stores a list of options to be used when instantiating an object
30: * with a matching alias.
31: *
32: * @param string|null $alias Name of the alias
33: * @param array|null $options list of options for the alias
34: * @return array The config data.
35: */
36: public function config($alias = null, $options = null);
37:
38: /**
39: * Get a table instance from the registry.
40: *
41: * @param string $alias The alias name you want to get.
42: * @param array $options The options you want to build the table with.
43: * @return \Cake\ORM\Table
44: */
45: public function get($alias, array $options = []);
46:
47: /**
48: * Check to see if an instance exists in the registry.
49: *
50: * @param string $alias The alias to check for.
51: * @return bool
52: */
53: public function exists($alias);
54:
55: /**
56: * Set an instance.
57: *
58: * @param string $alias The alias to set.
59: * @param \Cake\ORM\Table $object The table to set.
60: * @return \Cake\ORM\Table
61: */
62: public function set($alias, Table $object);
63:
64: /**
65: * Clears the registry of configuration and instances.
66: *
67: * @return void
68: */
69: public function clear();
70:
71: /**
72: * Removes an instance from the registry.
73: *
74: * @param string $alias The alias to remove.
75: * @return void
76: */
77: public function remove($alias);
78: }
79: