2014-05-02 09:32:47 +02:00
|
|
|
<?php
|
|
|
|
abstract class AbstractJob
|
|
|
|
{
|
2014-05-03 11:43:29 +02:00
|
|
|
const COMMENT_ID = 'comment-id';
|
|
|
|
const POST_ID = 'post-id';
|
|
|
|
const TAG_NAME = 'tag-name';
|
2014-05-03 14:20:48 +02:00
|
|
|
const TAG_NAMES = 'tags';
|
2014-05-03 11:43:29 +02:00
|
|
|
const TEXT = 'text';
|
|
|
|
const PAGE_NUMBER = 'page-number';
|
|
|
|
const QUERY = 'query';
|
|
|
|
const LOG_ID = 'log-id';
|
|
|
|
const STATE = 'state';
|
|
|
|
|
2014-05-02 09:32:47 +02:00
|
|
|
protected $arguments;
|
|
|
|
|
|
|
|
public function prepare()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public abstract function execute();
|
|
|
|
|
|
|
|
public abstract function requiresAuthentication();
|
|
|
|
public abstract function requiresConfirmedEmail();
|
|
|
|
public abstract function requiresPrivilege();
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|