1 | <?php |
||
33 | class ContractContext |
||
34 | { |
||
35 | |||
36 | /** |
||
37 | * @var int $contractDepth At which depth are we in the middle of an ongoing contract evaluation? |
||
38 | */ |
||
39 | private static $contractDepth = 0; |
||
40 | |||
41 | /** |
||
42 | * @const int MAX_NESTING_DEPTH The maximum depth we allow. |
||
43 | */ |
||
44 | const MAX_NESTING_DEPTH = 20; |
||
45 | |||
46 | /** |
||
47 | * Will open a contract context for any current ongoing verification. |
||
48 | * Will return true if successful (you are the only ongoing contract) and |
||
49 | * false if there already is something going on. |
||
50 | * |
||
51 | * @return bool |
||
52 | */ |
||
53 | public static function open() |
||
66 | |||
67 | /** |
||
68 | * Is there an ongoing contract beyond the maximal depth? |
||
69 | * |
||
70 | * @return bool |
||
71 | */ |
||
72 | public static function isOngoing() |
||
76 | |||
77 | /** |
||
78 | * Will close an open contract context for the ongoing verification. |
||
79 | * Will return true if contract was successfully closed and |
||
80 | * false if there was no contract at all. |
||
81 | * |
||
82 | * @throws \Exception |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | public static function close() |
||
105 | } |
||
106 |