Actually stable version.

This commit is contained in:
Joop Schilder
2019-01-17 00:49:53 +01:00
parent 826553a24e
commit be444f3b45
6 changed files with 195 additions and 61 deletions

55
src/Runtime.php Normal file
View File

@@ -0,0 +1,55 @@
<?php
namespace JoopSchilder\Asynchronous;
/**
* Class Runtime
* @package JoopSchilder\Asynchronous
*
* Created to keep track of the current runtime situation.
* This is critical in order for the application to know
* which destructors and handlers to call.
*/
class Runtime
{
/** @var bool */
private static $inParentRuntime = true;
/**
*
*/
public static function setChild()
{
self::$inParentRuntime = false;
}
/**
*
*/
public static function setParent()
{
self::$inParentRuntime = true;
}
/**
* @return bool
*/
public static function isParent()
{
return self::$inParentRuntime;
}
/**
* @return bool
*/
public static function isChild()
{
return !self::$inParentRuntime;
}
}