<?php

namespace CleantalkSP\SpbctWP\Scanner\OSCron;

class OSCronTaskAnalyser
{
    private $verdict = false;
    public function __construct()
    {
    }

    /**
     * @param string $command
     * @return $this
     */
    public function check($command)
    {
        $this->verdict = self::hasRM($command);
        //add more checks here
        return $this;
    }

    /**
     * Checks if a command is dangerous.
     *
     * @param string $command The command to check.
     * @return bool True if the command is dangerous, false otherwise.
     */
    private static function hasRM($command)
    {
        try {
            //implement command check here
            if (strpos($command, 'rm') !== false) {
                return true;
            }
        } catch (\Exception $e) {
            return false;
        }
        return false;
    }

    /**
     * @return bool
     */
    public function getVerdict()
    {
        return $this->verdict;
    }
}
