szurubooru/src/Api/AbstractJob.php

69 lines
1.1 KiB
PHP
Raw Normal View History

2014-05-02 09:32:47 +02:00
<?php
abstract class AbstractJob
{
const COMMENT_ID = 'comment-id';
const LOG_ID = 'log-id';
const POST_ENTITY = 'post';
const POST_ID = 'post-id';
const POST_NAME = 'post-name';
const TAG_NAME = 'tag-name';
2014-05-03 14:20:48 +02:00
const TAG_NAMES = 'tags';
const USER_ENTITY = 'user';
2014-05-04 14:57:44 +02:00
const USER_ID = 'user-id';
2014-05-04 10:09:21 +02:00
const USER_NAME = 'user-name';
const PAGE_NUMBER = 'page-number';
const TEXT = 'text';
const QUERY = 'query';
const STATE = 'state';
2014-05-02 09:32:47 +02:00
protected $arguments;
public function prepare()
{
}
public abstract function execute();
public function requiresAuthentication()
{
return false;
}
public function requiresConfirmedEmail()
{
return false;
}
public function requiresPrivilege()
{
return false;
}
2014-05-02 09:32:47 +02:00
public function getArgument($key)
{
2014-05-03 14:20:48 +02:00
if (!$this->hasArgument($key))
throw new ApiMissingArgumentException($key);
2014-05-02 09:32:47 +02:00
return $this->arguments[$key];
}
2014-05-03 14:20:48 +02:00
public function getArguments()
{
return $this->arguments;
}
public function hasArgument($key)
{
return isset($this->arguments[$key]);
}
2014-05-02 09:32:47 +02:00
public function setArguments($arguments)
{
$this->arguments = $arguments;
}
}