<?php

namespace Fab\Plugin\Helper;

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

/**
 * Input Helper
 *
 * @package    Fab
 * @subpackage Fab\Plugin\Helper
 */
trait Input {

    /**
     * Check Input Exists.
     *
     * @param array $input The input to check.
     * @param bool  $input_exists The input exists.
     * @return bool
     */
    public function check_input( $input, $input_exists = false ) {
        // Get Parameters.
        $params = $_POST;  // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce is verified earlier.

        // Check Input Exists.
        foreach ( $input as $key => $value ) {
            if ( isset( $params[ $key ] ) ) {
                $input_exists = true;
                break;
            }
        }

        return $input_exists;
    }
}
