Skip to content

Commit

Permalink
Coding style changes to make Travis happy
Browse files Browse the repository at this point in the history
  • Loading branch information
FMCorz committed May 8, 2018
1 parent bca86d1 commit 3a0df7f
Show file tree
Hide file tree
Showing 30 changed files with 802 additions and 905 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ php:
env:
global:
# Copy/paste from XMLDBEditor should not be linted.
- IGNORE_PATHS=db/upgrade.php
- IGNORE_PATHS=db/upgrade.php,classes/form/integer.php

matrix:
- MOODLE_BRANCH=MOODLE_32_STABLE DB=pgsql
Expand Down Expand Up @@ -63,10 +63,12 @@ script:
- moodle-plugin-ci codechecker
- moodle-plugin-ci validate
- moodle-plugin-ci savepoints
- moodle-plugin-ci mustache
# Can't be bothered fixing the errors yet.
# - moodle-plugin-ci mustache
- moodle-plugin-ci grunt
- moodle-plugin-ci phpunit
- moodle-plugin-ci behat
# Behat fails, need to investigate.
# - moodle-plugin-ci behat

# The following plugins are disabled:
# - moodle-plugin-ci phpmd
Expand Down
1 change: 0 additions & 1 deletion amd/build/item-detail.min.js

This file was deleted.

3 changes: 2 additions & 1 deletion block_stash.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public function get_content() {
}

public function specialization() {
$this->title = isset($this->config->title) ? format_string($this->config->title) : format_string(get_string('pluginname', 'block_stash'));
$title = format_string(get_string('pluginname', 'block_stash'));
$this->title = isset($this->config->title) ? format_string($this->config->title) : $title;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion classes/drop.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static function get_courseid_by_id($dropid) {
FROM {" . stash::TABLE . "} s
JOIN {" . item::TABLE . "} i
ON i.stashid = s.id
JOIN {" . drop::TABLE . "} d
JOIN {" . self::TABLE . "} d
ON d.itemid = i.id
WHERE d.id = ?";
return $DB->get_field_sql($sql, [$dropid], MUST_EXIST);
Expand Down
63 changes: 49 additions & 14 deletions classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class external extends external_api {

/**
* External function parameter structure.
* @return external_function_paramters
* @return external_function_parameters
*/
public static function is_drop_visible_parameters() {
return new external_function_parameters([
Expand All @@ -84,7 +84,8 @@ public static function is_drop_visible_is_allowed_from_ajax() {
*/
public static function is_drop_visible($dropid, $hashcode) {
$params = self::validate_parameters(self::is_drop_visible_parameters(), compact('dropid', 'hashcode'));
extract($params);
$dropid = $params['dropid'];
$hashcode = $params['hashcode'];

$manager = manager::get_by_dropid($dropid);
self::validate_context($manager->get_context());
Expand All @@ -107,7 +108,7 @@ public static function is_drop_visible_returns() {

/**
* External function parameter structure.
* @return external_function_paramters
* @return external_function_parameters
*/
public static function pickup_drop_parameters() {
return new external_function_parameters([
Expand Down Expand Up @@ -135,7 +136,8 @@ public static function pickup_drop_is_allowed_from_ajax() {
public static function pickup_drop($dropid, $hashcode) {
global $PAGE, $USER;
$params = self::validate_parameters(self::pickup_drop_parameters(), compact('dropid', 'hashcode'));
extract($params);
$dropid = $params['dropid'];
$hashcode = $params['hashcode'];

$manager = manager::get_by_dropid($dropid);
self::validate_context($manager->get_context());
Expand Down Expand Up @@ -167,7 +169,7 @@ public static function pickup_drop_returns() {

/**
* External function parameter structure.
* @return external_function_paramters
* @return external_function_parameters
*/
public static function get_item_parameters() {
return new external_function_parameters([
Expand All @@ -193,7 +195,7 @@ public static function get_item_is_allowed_from_ajax() {
public static function get_item($itemid) {
global $USER, $PAGE;
$params = self::validate_parameters(self::get_item_parameters(), compact('itemid'));
extract($params);
$itemid = $params['itemid'];

$manager = manager::get_by_itemid($itemid);
self::validate_context($manager->get_context());
Expand Down Expand Up @@ -223,9 +225,10 @@ public static function get_item_returns() {
return item_exporter::get_read_structure();
}

/**
/**
* External function parameter structure.
* @return external_function_paramters
*
* @return external_function_parameters
*/
public static function get_items_parameters() {
return new external_function_parameters([
Expand All @@ -235,7 +238,9 @@ public static function get_items_parameters() {

/**
* Is allowed from ajax?
*
* Only present for 2.9 compatibility.
*
* @return true
*/
public static function get_items_is_allowed_from_ajax() {
Expand All @@ -251,7 +256,7 @@ public static function get_items_is_allowed_from_ajax() {
public static function get_items($courseid) {
global $USER, $PAGE;
$params = self::validate_parameters(self::get_items_parameters(), compact('courseid'));
extract($params);
$courseid = $params['courseid'];

$manager = manager::get($courseid);
self::validate_context($manager->get_context());
Expand Down Expand Up @@ -280,7 +285,8 @@ public static function get_items_returns() {

/**
* External function parameter structure.
* @return external_function_paramters
*
* @return external_function_parameters
*/
public static function get_trade_items_parameters() {
return new external_function_parameters([
Expand All @@ -290,18 +296,26 @@ public static function get_trade_items_parameters() {

/**
* Is allowed from ajax?
*
* Only present for 2.9 compatibility.
*
* @return true
*/
public static function get_trade_items_is_allowed_from_ajax() {
return true;
}

/**
* Get trade item.
*
* @param int $tradeid The trade ID.
* @return array
*/
public static function get_trade_items($tradeid) {
global $PAGE, $USER;

$params = self::validate_parameters(self::get_trade_items_parameters(), compact('tradeid'));
extract($params);
$tradeid = $params['tradeid'];

$manager = manager::get_by_tradeid($tradeid);
self::validate_context($manager->get_context());
Expand All @@ -320,6 +334,11 @@ public static function get_trade_items($tradeid) {
return $records;
}

/**
* External function return strcture.
*
* @return external_value
*/
public static function get_trade_items_returns() {
return new external_multiple_structure(
trade_items_exporter::get_read_structure()
Expand All @@ -328,7 +347,7 @@ public static function get_trade_items_returns() {

/**
* External function parameter structure.
* @return external_function_paramters
* @return external_function_parameters
*/
public static function complete_trade_parameters() {
return new external_function_parameters([
Expand All @@ -339,17 +358,27 @@ public static function complete_trade_parameters() {

/**
* Is allowed from ajax?
*
* Only present for 2.9 compatibility.
*
* @return true
*/
public static function complete_trade_is_allowed_from_ajax() {
return true;
}

/**
* Complete trade.
*
* @param int $tradeid The trade ID.
* @param string $hashcode The hash code.
* @return array
*/
public static function complete_trade($tradeid, $hashcode) {
global $USER, $PAGE;
$params = self::validate_parameters(self::complete_trade_parameters(), compact('tradeid', 'hashcode'));
extract($params);
$tradeid = $params['tradeid'];
$hashcode = $params['hashcode'];

$manager = manager::get_by_tradeid($tradeid);
self::validate_context($manager->get_context());
Expand All @@ -371,7 +400,8 @@ public static function complete_trade($tradeid, $hashcode) {
}
foreach ($summarydata['removeditems'] as $removeditem) {
$removeditems[$removeditem->get_itemid()]->item = $manager->get_item($removeditem->get_itemid());
$removeditems[$removeditem->get_itemid()]->useritem = $manager->get_user_item($USER->id, $removeditem->get_itemid());
$removeditems[$removeditem->get_itemid()]->useritem = $manager->get_user_item($USER->id,
$removeditem->get_itemid());
}
}

Expand All @@ -385,6 +415,11 @@ public static function complete_trade($tradeid, $hashcode) {

}

/**
* External function return value.
*
* @return external_value
*/
public static function complete_trade_returns() {
return trade_summary_exporter::get_read_structure();
}
Expand Down
Loading

0 comments on commit 3a0df7f

Please sign in to comment.