< Summary

Information
Class: Gravitas.Support.OrderedLifecycleHook
Assembly: Gravitas
File(s): /home/runner/work/Gravitas/Gravitas/src/Gravitas/Support/LifecycleHooks/OrderedLifecycleHook.cs
Line coverage
100%
Covered lines: 5
Uncovered lines: 0
Coverable lines: 5
Total lines: 46
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%

File(s)

/home/runner/work/Gravitas/Gravitas/src/Gravitas/Support/LifecycleHooks/OrderedLifecycleHook.cs

#LineLine coverage
 1//=======================================================================
 2// OrderedLifecycleHook.cs
 3//=======================================================================
 4// MIT License, Copyright (c) 2026–present David Oravsky (mrdav30)
 5// See LICENSE file in the project root for full license information.
 6//=======================================================================
 7
 8using System;
 9
 10namespace Gravitas.Support;
 11
 12/// <summary>
 13/// Represents a lifecycle hook with an associated owner, execution order, and callback action.
 14/// </summary>
 15public sealed class OrderedLifecycleHook
 16{
 17    /// <summary>
 18    /// Initializes a new instance of the OrderedLifecycleHook class with the specified owner, order, and callback.
 19    /// </summary>
 20    /// <param name="owner">The owner of the lifecycle hook.</param>
 21    /// <param name="order">The execution order of the lifecycle hook.</param>
 22    /// <param name="callback">The callback action to be invoked for the lifecycle hook.</param>
 1523    public OrderedLifecycleHook(string owner, int order, Action callback)
 24    {
 1525        Owner = owner;
 1526        Order = order;
 1527        Callback = callback;
 1528    }
 29
 30    /// <summary>
 31    /// Gets the owner of the lifecycle hook, which is used to identify and manage the hook within the system.
 32    /// </summary>
 33    public string Owner { get; }
 34
 35    /// <summary>
 36    /// Gets the execution order of the lifecycle hook, determining the sequence in which it will be invoked relative to
 37    /// Hooks with lower order values will be executed before those with higher values.
 38    /// </summary>
 39    public int Order { get; }
 40
 41    /// <summary>
 42    /// Gets the callback action associated with the lifecycle hook, which will be invoked when the hook is executed.
 43    /// This action defines the behavior that will occur when the lifecycle event associated with the hook is triggered.
 44    /// </summary>
 45    public Action Callback { get; }
 46}