[TASK] Harden \TYPO3\CMS\Extbase\Object\ObjectManager
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Object / ObjectManagerInterface.php
1 <?php
2 declare(strict_types = 1);
3
4 namespace TYPO3\CMS\Extbase\Object;
5
6 /*
7 * This file is part of the TYPO3 CMS project.
8 *
9 * It is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License, either version 2
11 * of the License, or any later version.
12 *
13 * For the full copyright and license information, please read the
14 * LICENSE.txt file that was distributed with this source code.
15 *
16 * The TYPO3 project - inspiring people to share!
17 */
18
19 /**
20 * Interface for the TYPO3 Object Manager
21 */
22 interface ObjectManagerInterface extends \TYPO3\CMS\Core\SingletonInterface
23 {
24 /**
25 * Returns TRUE if an object with the given name is registered
26 *
27 * @param string $objectName Name of the object
28 * @return bool TRUE if the object has been registered, otherwise FALSE
29 * @internal only to be used within Extbase, not part of TYPO3 Core API.
30 */
31 public function isRegistered(string $objectName): bool;
32
33 /**
34 * Returns a fresh or existing instance of the object specified by $objectName.
35 *
36 * @param string $objectName The name of the object to return an instance of
37 * @param array ...$constructorArguments
38 * @return object The object instance
39 */
40 public function get(string $objectName, ...$constructorArguments): object;
41
42 /**
43 * Create an instance of $className without calling its constructor
44 *
45 * @param string $className
46 * @return object
47 */
48 public function getEmptyObject(string $className): object;
49
50 /**
51 * Returns the scope of the specified object.
52 *
53 * @param string $objectName The object name
54 * @return int One of the Container::SCOPE_ constants
55 * @internal only to be used within Extbase, not part of TYPO3 Core API.
56 */
57 public function getScope(string $objectName): int;
58 }