src/Tor.php
public function command($command)
    {
        if (!in_array($command, ['start', 'stop', 'restart', 'reload', 'force-reload', 'status'])) {
            throw new \InvalidArgumentException($command);
        }

        $command = 'sudo /etc/init.d/tor '.$command;
        $command = new Command($command);
        $command->execute();

        return $command;
    }
public function command($command)
    {
        if (!in_array($command, ['start', 'stop', 'restart', 'reload', 'force-reload', 'status'])) {
            throw new \InvalidArgumentException($command);
        }

        $command = 'sudo /etc/init.d/tor '.$command;
        $command = new Command($command);
        $command->execute();

        return $command;
    }
public function command ( $ command ) { if ( ! in_array ( $ command , [ 'start' , 'stop' , 'restart' , 'reload' , 'force-reload' , 'status' ] ) ) { throw new \ InvalidArgumentException ( $ command ) ; } $ command = 'sudo /etc/init.d/tor ' . $ command ; $ command = new Command ( $ command ) ; $ command -> execute ( ) ; return $ command ; }
Execute tor command

@param $command
@return Command|string
Execute tor command