MDL-24276 "static abstract" combination is deprecated since PHP 5.2, replacing with our coding_style exception

This commit is contained in:
Petr Skoda
2010-09-19 18:43:52 +00:00
parent dc157e0903
commit 7c109ea3f0
12 changed files with 61 additions and 23 deletions
@@ -274,6 +274,8 @@ abstract class backup_activity_task extends backup_task {
* Code the transformations to perform in the activity in
* order to get transportable (encoded) links
*/
abstract static public function encode_content_links($content);
static public function encode_content_links($content) {
throw new coding_exception('encode_content_links() method needs to be overridden in each subclass of backup_activity_task');
}
}
+3 -1
View File
@@ -210,5 +210,7 @@ abstract class backup_block_task extends backup_task {
* Code the transformations to perform in the block in
* order to get transportable (encoded) links
*/
abstract static public function encode_content_links($content);
static public function encode_content_links($content) {
throw new coding_exception('encode_content_links() method needs to be overridden in each subclass of backup_block_task');
}
}
@@ -216,13 +216,17 @@ abstract class restore_activity_task extends restore_task {
* Define the contents in the activity that must be
* processed by the link decoder
*/
abstract static public function define_decode_contents();
static public function define_decode_contents() {
throw new coding_exception('define_decode_contents() method needs to be overridden in each subclass of restore_activity_task');
}
/**
* Define the decoding rules for links belonging
* to the activity to be executed by the link decoder
*/
abstract static public function define_decode_rules();
static public function define_decode_rules() {
throw new coding_exception('define_decode_rules() method needs to be overridden in each subclass of restore_activity_task');
}
// Protected API starts here
+6 -2
View File
@@ -152,13 +152,17 @@ abstract class restore_block_task extends restore_task {
* Define the contents in the activity that must be
* processed by the link decoder
*/
abstract static public function define_decode_contents();
static public function define_decode_contents() {
throw new coding_exception('define_decode_contents() method needs to be overridden in each subclass of restore_block_task');
}
/**
* Define the decoding rules for links belonging
* to the activity to be executed by the link decoder
*/
abstract static public function define_decode_rules();
static public function define_decode_rules() {
throw new coding_exception('define_decode_rules() method needs to be overridden in each subclass of restore_block_task');
}
// Protected API starts here
+3 -1
View File
@@ -212,7 +212,9 @@ abstract class base_ui {
* Loads the backup controller if we are tracking one
* @return backup_controller|false
*/
abstract public static function load_controller($uniqueid=false);
public static function load_controller($uniqueid=false) {
throw new coding_exception('load_controller() method needs to be overridden in each subclass of base_ui');
}
/**
* Gets an array of progress bar items that can be displayed through the backup renderer.
* @return array Array of items for the progress bar
+7 -3
View File
@@ -104,15 +104,19 @@ abstract class data_object {
* @param array $params associative arrays varname=>value
* @return object data_object instance or false if none found.
*/
public static abstract function fetch($params);
public static function fetch($params) {
throw new coding_exception('fetch() method needs to be overridden in each subclass of data_object');
}
/**
* Finds and returns all data_object instances based on params.
*
* @param array $params associative arrays varname=>value
* @return array array of data_object insatnces or false if none found.
* @return array array of data_object instances or false if none found.
*/
public static function fetch_all($params) {}
public static function fetch_all($params) {
throw new coding_exception('fetch_all() method needs to be overridden in each subclass of data_object');
}
/**
* Factory method - uses the parameters to retrieve matching instance from the DB.
+1 -1
View File
@@ -1188,7 +1188,7 @@ abstract class sql_generator {
* @return array of reserved words
*/
public static function getReservedWords() {
return array();
throw new coding_exception('getReservedWords() method needs to be overridden in each subclass of sql_generator');
}
/**
+5 -3
View File
@@ -42,12 +42,14 @@ require_once($CFG->libdir.'/filelib.php');
* @copyright Dan Poltawski <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class google_auth_request extends curl{
abstract class google_auth_request extends curl {
protected $token = '';
private $persistantheaders = array();
// Must be overriden with the authorization header name
public abstract static function get_auth_header_name();
// Must be overridden with the authorization header name
public static function get_auth_header_name() {
throw new coding_exception('get_auth_header_name() method needs to be overridden in each subclass of google_auth_request');
}
protected function request($url, $options = array()){
if($this->token){
+6 -2
View File
@@ -119,7 +119,9 @@ abstract class grade_object {
* @param array $params associative arrays varname=>value
* @return object grade_object instance or false if none found.
*/
public static abstract function fetch($params);
public static function fetch($params) {
throw new coding_exception('fetch() method needs to be overridden in each subclass of grade_object');
}
/**
* Finds and returns all grade_object instances based on params.
@@ -128,7 +130,9 @@ abstract class grade_object {
* @param array $params associative arrays varname=>value
* @return array array of grade_object instances or false if none found.
*/
public static abstract function fetch_all($params);
public static function fetch_all($params) {
throw new coding_exception('fetch_all() method needs to be overridden in each subclass of grade_object');
}
/**
* Factory method - uses the parameters to retrieve matching instance from the DB.
+9 -3
View File
@@ -334,7 +334,9 @@ abstract class portfolio_caller_base {
return portfolio_most_specific_formats($specific, $basic);
}
public abstract static function base_supported_formats();
public static function base_supported_formats() {
throw new coding_exception('base_supported_formats() method needs to be overridden in each subclass of portfolio_caller_base');
}
/**
* this is the "return to where you were" url
@@ -352,7 +354,9 @@ abstract class portfolio_caller_base {
/**
* nice name to display to the user about this caller location
*/
public abstract static function display_name();
public static function display_name() {
throw new coding_exception('display_name() method needs to be overridden in each subclass of portfolio_caller_base');
}
/**
* return a string to put at the header summarising this export
@@ -475,7 +479,9 @@ abstract class portfolio_caller_base {
*
* @return array
*/
public static abstract function expected_callbackargs();
public static function expected_callbackargs() {
throw new coding_exception('expected_callbackargs() method needs to be overridden in each subclass of portfolio_caller_base');
}
/**
+9 -3
View File
@@ -39,14 +39,18 @@ abstract class portfolio_format {
/**
* array of mimetypes this format supports
*/
public static abstract function mimetypes();
public static function mimetypes() {
throw new coding_exception('mimetypes() method needs to be overridden in each subclass of portfolio_format');
}
/**
* for multipart formats, eg html with attachments,
* we need to have a directory to place associated files in
* inside the zip file. this is the name of that directory
*/
public static abstract function get_file_directory();
public static function get_file_directory() {
throw new coding_exception('get_file_directory() method needs to be overridden in each subclass of portfolio_format');
}
/**
* given a file, return a snippet of markup in whatever format
@@ -62,7 +66,9 @@ abstract class portfolio_format {
*
* @return string some html or xml or whatever
*/
public static abstract function file_output($file, $options=null);
public static function file_output($file, $options=null) {
throw new coding_exception('file_output() method needs to be overridden in each subclass of portfolio_format');
}
public static function make_tag($file, $path, $attributes) {
$srcattr = 'href';
+3 -1
View File
@@ -153,7 +153,9 @@ abstract class portfolio_plugin_base {
*
* @return string
*/
public static abstract function get_name();
public static function get_name() {
throw new coding_exception('get_name() method needs to be overridden in each subclass of portfolio_plugin_base');
}
/**
* check sanity of plugin