<?php
/**
 * Author: Rymera Web Co.
 *
 * @package SAAI
 */

namespace SAAI\Abstracts;

use WP_CLI;
use WP_CLI_Command;

defined( 'ABSPATH' ) || exit;

/**
 * Abstract CLI
 *
 * @phpcs:disable Squiz.Commenting.FunctionComment.MissingParamTag
 */
abstract class Abstract_CLI extends WP_CLI_Command {

    /**
     * Get the command string for this CLI class.
     *
     * @return string The command for this CLI class.
     */
    public function command() {
        return strtolower( wp_basename( get_class( $this ) ) );
    }

    /**
     * Just a test.
     *
     * ## OPTIONS
     *
     * ## EXAMPLES
     * wp idxrp test
     */
    public function test( $args = array(), $assoc_args = array() ) {
        try {
            $filename = WP_CONTENT_DIR . '/cli-test-file.php';
            if ( file_exists( $filename ) ) {
                include $filename;
            }
        } catch ( \Exception $exception ) {
            WP_CLI::error( $exception->getMessage() );
        }
    }
}
