# mainwp/6.0.12/class/class-mainwp-stack-helper.php

MainWP Dashboard: Self-hosted WordPress Management for Agencies, version 6.0.12. 98 lines.

- Page: https://pluginprobe.com/plugins/mainwp/6.0.12/code/class/class-mainwp-stack-helper.php
- Raw: https://pluginprobe.com/plugins/mainwp/6.0.12/raw/class/class-mainwp-stack-helper.php
- Modified: 2026-02-24T16:08:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/mainwp/6.0.12/code/class/class-mainwp-stack-helper.php#L10-L20`.

```php
<?php
/**
 * MainWP Utility Helper.
 *
 * @package MainWP/Dashboard
 */

namespace MainWP\Dashboard;

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

// phpcs:disable WordPress.DB.RestrictedFunctions, WordPress.WP.AlternativeFunctions, WordPress.PHP.NoSilencedErrors, Generic.Metrics.CyclomaticComplexity -- Using cURL functions.

/**
 * Class MainWP_Stack_Helper
 *
 * @package MainWP\Dashboard
 */
class MainWP_Stack_Helper { // phpcs:ignore Generic.Classes.OpeningBraceSameLine.ContentAfterBrace -- NOSONAR.

    /**
     * Working stack.
     *
     * @var array $working_stack Working stack.
     */
    private static $working_stack = array();

    /**
     * Stack push
     *
     * @param  mixed $action
     * @return void
     */
    public static function stack_push( $action ) {
        self::$working_stack[] = $action;
    }

    /**
     * Stack pop
     *
     * @return void
     */
    public static function stack_pop() {
        return array_pop( self::$working_stack );
    }

    /**
     * Stack current
     *
     * @return void
     */
    public static function stack_current() {
        return self::$working_stack ? end( self::$working_stack ) : null;
    }

    /**
     * Stack all
     *
     * @return void
     */
    public static function stack_all() {
        return self::$working_stack;
    }

    /**
     * Stack clear
     *
     * @return void
     */
    public static function stack_clear() {
        self::$stack = array();
    }

    /**
     * In stack
     *
     * @param  mixed $action
     * @return void
     */
    public static function in_stack( $action ) {
        return in_array( $action, self::$working_stack, true );
    }

    /**
     * is_current_stack
     *
     * @param  mixed $action
     * @return void
     */
    public static function is_current_stack( $action ) {
        return self::stack_current() === $action;
    }

}

```
