-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInitializable.php
62 lines (55 loc) · 1.38 KB
/
Initializable.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* Handler interface file.
*
* @package eXtended WordPress
* @subpackage Contracts
*/
namespace XWP\Contracts\Hook;
use ReflectionClass;
/**
* Handler interface.
*
* @template THndlr of object
*
* @property-read Initialize $strategy Invocation strategy.
* @property-read class-string<THndlr> $classname Handler classname.
* @property-read bool $initialized Indicates if the handler has been initialized.
* @property THndlr|null $target Handler target.
*
* @extends Hookable<THndlr,ReflectionClass<THndlr>>
*/
interface Initializable extends Hookable {
/**
* Set the classname.
*
* @param class-string<THndlr> $classname Handler classname.
* @return static
*/
public function with_classname( string $classname ): static;
/**
* Set the handler instance.
*
* @param THndlr $instance Handler instance.
* @return static
*/
public function with_target( object $instance ): static;
/**
* Get the handler instance.
*
* @return THndlr
*/
public function get_target(): ?object;
/**
* Initializes the handler.
*
* @return static
*/
public function initialize(): static;
/**
* Check if the handler can be initialized.
*
* @return bool
*/
public function can_initialize(): bool;
}