MDL-58398 core_files: Fix phpdoc and other minor issues

This commit is contained in:
Ankit Agarwal 2017-03-27 14:37:09 +05:30
parent 216ea39be7
commit 92a951c5cd
5 changed files with 22 additions and 19 deletions

View file

@ -61,6 +61,11 @@ class conversion extends \core\persistent {
*/ */
const TABLE = 'file_conversion'; const TABLE = 'file_conversion';
/**
* Define properties.
*
* @return array
*/
protected static function define_properties() { protected static function define_properties() {
return array( return array(
'sourcefileid' => [ 'sourcefileid' => [
@ -209,7 +214,7 @@ class conversion extends \core\persistent {
/** /**
* Fetch the source file. * Fetch the source file.
* *
* @return stored_file|false * @return stored_file|false The source file
*/ */
public function get_sourcefile() { public function get_sourcefile() {
$fs = get_file_storage(); $fs = get_file_storage();
@ -276,7 +281,7 @@ class conversion extends \core\persistent {
/** /**
* Get the destination file. * Get the destination file.
* *
* @return stored_file|this * @return stored_file|bool Destination file
*/ */
public function get_destfile() { public function get_destfile() {
$fs = get_file_storage(); $fs = get_file_storage();
@ -287,7 +292,7 @@ class conversion extends \core\persistent {
/** /**
* Helper to ensure that the returned status is always an int. * Helper to ensure that the returned status is always an int.
* *
* @return int * @return int status
*/ */
protected function get_status() { protected function get_status() {
return (int) $this->raw_get('status'); return (int) $this->raw_get('status');
@ -296,7 +301,7 @@ class conversion extends \core\persistent {
/** /**
* Get an instance of the current converter. * Get an instance of the current converter.
* *
* @return converter_interface|false * @return converter_interface|false current converter instance
*/ */
public function get_converter_instance() { public function get_converter_instance() {
$currentconverter = $this->get('converter'); $currentconverter = $this->get('converter');
@ -311,7 +316,7 @@ class conversion extends \core\persistent {
/** /**
* Transform data into a storable format. * Transform data into a storable format.
* *
* @param stdClass $data The data to be stored * @param \stdClass $data The data to be stored
* @return $this * @return $this
*/ */
protected function set_data($data) { protected function set_data($data) {
@ -323,7 +328,7 @@ class conversion extends \core\persistent {
/** /**
* Transform data into a storable format. * Transform data into a storable format.
* *
* @return stdClass The stored data * @return \stdClass The stored data
*/ */
protected function get_data() { protected function get_data() {
$data = $this->raw_get('data'); $data = $this->raw_get('data');
@ -338,7 +343,7 @@ class conversion extends \core\persistent {
/** /**
* Return the file record base for use in the files table. * Return the file record base for use in the files table.
* *
* @return array * @return array|bool
*/ */
protected function get_file_record() { protected function get_file_record() {
$file = $this->get_sourcefile(); $file = $this->get_sourcefile();

View file

@ -39,7 +39,7 @@ class converter {
/** /**
* Get a list of enabled plugins and classes. * Get a list of enabled plugins and classes.
* *
* @return array * @return array List of enabled plugins
*/ */
protected function get_enabled_plugins() { protected function get_enabled_plugins() {
$plugins = \core\plugininfo\fileconverter::get_enabled_plugins(); $plugins = \core\plugininfo\fileconverter::get_enabled_plugins();
@ -57,7 +57,7 @@ class converter {
* *
* This allows for mocking of the file_storage API. * This allows for mocking of the file_storage API.
* *
* @return file_storage * @return \file_storage
*/ */
protected function get_file_storage() { protected function get_file_storage() {
return get_file_storage(); return get_file_storage();
@ -69,7 +69,7 @@ class converter {
* @param stored_file $file The file to convert * @param stored_file $file The file to convert
* @param string $format The desired target file format (file extension) * @param string $format The desired target file format (file extension)
* @param boolean $forcerefresh If true, the file will be converted every time (not cached). * @param boolean $forcerefresh If true, the file will be converted every time (not cached).
* @return conversion * @return conversion conversion object
*/ */
public function start_conversion(stored_file $file, $format, $forcerefresh = false) { public function start_conversion(stored_file $file, $format, $forcerefresh = false) {
$conversions = conversion::get_conversions_for_file($file, $format); $conversions = conversion::get_conversions_for_file($file, $format);
@ -160,7 +160,7 @@ class converter {
* *
* @param array $converters The list of converters to try * @param array $converters The list of converters to try
* @param string|null $currentconverter The converter currently in use * @param string|null $currentconverter The converter currently in use
* @return string|false * @return string|false Name of next converter if present
*/ */
protected function get_next_converter($converters, $currentconverter = null) { protected function get_next_converter($converters, $currentconverter = null) {
if ($currentconverter) { if ($currentconverter) {
@ -226,7 +226,7 @@ class converter {
$from = \core_filetypes::get_file_extension($file->get_mimetype()); $from = \core_filetypes::get_file_extension($file->get_mimetype());
if (!$from) { if (!$from) {
// No mimetype could be found. Unable to determine converter. // No mime type could be found. Unable to determine converter.
return false; return false;
} }

View file

@ -1,5 +1,4 @@
<?php <?php
// This file is part of Moodle - http://moodle.org/ // This file is part of Moodle - http://moodle.org/
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify

View file

@ -26,8 +26,8 @@ namespace fileconverter_unoconv;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/filelib.php'); require_once($CFG->libdir . '/filelib.php');
use stored_file;
use stored_file;
use \core_files\conversion; use \core_files\conversion;
/** /**
@ -118,9 +118,9 @@ class converter implements \core_files\converter_interface {
try { try {
// This function can either return false, or throw an exception so we need to handle both. // This function can either return false, or throw an exception so we need to handle both.
if ($file->copy_content_to($filename) === false) { if ($file->copy_content_to($filename) === false) {
throw new file_exception('storedfileproblem', 'Could not copy file contents to temp file.'); throw new \file_exception('storedfileproblem', 'Could not copy file contents to temp file.');
} }
} catch (file_exception $fe) { } catch (\file_exception $fe) {
throw $fe; throw $fe;
} }
@ -169,7 +169,7 @@ class converter implements \core_files\converter_interface {
/** /**
* Generate and serve the test document. * Generate and serve the test document.
* *
* @return stored_file * @return void
*/ */
public function serve_test_document() { public function serve_test_document() {
global $CFG; global $CFG;
@ -267,7 +267,7 @@ class converter implements \core_files\converter_interface {
/** /**
* Whether the plugin is fully configured. * Whether the plugin is fully configured.
* *
* @return bool * @return \stdClass
*/ */
public static function test_unoconv_path() { public static function test_unoconv_path() {
global $CFG; global $CFG;

View file

@ -24,7 +24,6 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
/** /**
* A set of tests for some of the unoconv functionality within Moodle. * A set of tests for some of the unoconv functionality within Moodle.
* *