1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-11-16 16:30:09 +00:00
Tims-Chat/files/lib/system/command/ICommand.class.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
2.3 KiB
PHP
Raw Normal View History

2018-08-16 22:30:59 +00:00
<?php
2022-03-04 17:10:24 +00:00
2018-08-16 22:30:59 +00:00
/*
2024-01-13 20:03:36 +00:00
* Copyright (c) 2010-2024 Tim Düsterhus.
2018-08-16 22:30:59 +00:00
*
* Use of this software is governed by the Business Source License
* included in the LICENSE file.
*
2024-06-15 19:56:58 +00:00
* Change Date: 2028-06-15
2018-08-16 22:30:59 +00:00
*
* On the date above, in accordance with the Business Source
* License, use of this software will be governed by version 2
* or later of the General Public License.
*/
namespace chat\system\command;
2022-03-04 17:10:24 +00:00
use chat\data\room\Room;
use wcf\data\user\UserProfile;
2018-08-16 22:30:59 +00:00
/**
* Interface for Command processors.
*/
2022-03-04 17:10:24 +00:00
interface ICommand
{
/**
* Returns whether the command can be used even when
* no trigger is configured for it.
*
* @return boolean
*/
public function allowWithoutTrigger();
2018-08-16 22:30:59 +00:00
2022-03-04 17:10:24 +00:00
/**
* Returns the name of the JavaScript module.
*
* @return string
*/
public function getJavaScriptModuleName();
2018-08-16 22:30:59 +00:00
2022-03-04 17:10:24 +00:00
/**
* Returns whether this command theoretically is available
* in the given room, for the given user.
* If no user is given the active user should be assumed.
*
* The return value sets a flag for the JavaScript to
* consume. You still need to validate() this as well!
*
* @param Room $room
* @param UserProfile $user
* @return boolean
*/
public function isAvailable(Room $room, ?UserProfile $user = null);
2018-08-16 22:30:59 +00:00
2022-03-04 17:10:24 +00:00
/**
* Validates the execution of the command with the given parameters
* in the given room for the given user.
* If no user is given the active user should be assumed.
* This method must throw if the command may not be executed in this form.
*
* @param mixed $parameters
* @param Room $room
* @param UserProfile $user
*/
public function validate($parameters, Room $room, ?UserProfile $user = null);
2018-08-16 22:30:59 +00:00
2022-03-04 17:10:24 +00:00
/**
* Executes the command with the given parameters in the given room in
* the context of the given user.
* If no user is given the active user should be assumed.
* This method must throw if the command may not be executed in this form.
*
* @param mixed $parameters
* @param Room $room
* @param UserProfile $user
*/
public function execute($parameters, Room $room, ?UserProfile $user = null);
2018-08-16 22:30:59 +00:00
}