GracefulDeath\Builder::toReanimationPolicy PHP Method

toReanimationPolicy() private method

private toReanimationPolicy ( $policy )
    private function toReanimationPolicy($policy)
    {
        if (is_integer($policy)) {
            return function ($status, $attempts, $stdout, $stderr) use($policy) {
                return $policy >= $attempts;
            };
        }
        if (is_bool($policy)) {
            return function ($status, $attempts, $stdout, $stderr) use($policy) {
                return $policy;
            };
        }
        if (is_callable($policy)) {
            return $policy;
        }
        throw new InvalidArgumentException("'{$policy}' could not be converted to a reanimation policy");
    }