Skip to content

Commit

Permalink
MDL-58398 core_files: Fix phpdoc and other minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitagarwal committed Mar 31, 2017
1 parent 216ea39 commit 92a951c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
19 changes: 12 additions & 7 deletions files/classes/conversion.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class conversion extends \core\persistent {
*/
const TABLE = 'file_conversion';

/**
* Define properties.
*
* @return array
*/
protected static function define_properties() {
return array(
'sourcefileid' => [
Expand Down Expand Up @@ -209,7 +214,7 @@ public function set_sourcefile(stored_file $file) {
/**
* Fetch the source file.
*
* @return stored_file|false
* @return stored_file|false The source file
*/
public function get_sourcefile() {
$fs = get_file_storage();
Expand Down Expand Up @@ -276,7 +281,7 @@ public function store_destfile_from_string($content) {
/**
* Get the destination file.
*
* @return stored_file|this
* @return stored_file|bool Destination file
*/
public function get_destfile() {
$fs = get_file_storage();
Expand All @@ -287,7 +292,7 @@ public function get_destfile() {
/**
* Helper to ensure that the returned status is always an int.
*
* @return int
* @return int status
*/
protected function get_status() {
return (int) $this->raw_get('status');
Expand All @@ -296,7 +301,7 @@ protected function get_status() {
/**
* Get an instance of the current converter.
*
* @return converter_interface|false
* @return converter_interface|false current converter instance
*/
public function get_converter_instance() {
$currentconverter = $this->get('converter');
Expand All @@ -311,7 +316,7 @@ public function get_converter_instance() {
/**
* Transform data into a storable format.
*
* @param stdClass $data The data to be stored
* @param \stdClass $data The data to be stored
* @return $this
*/
protected function set_data($data) {
Expand All @@ -323,7 +328,7 @@ protected function set_data($data) {
/**
* Transform data into a storable format.
*
* @return stdClass The stored data
* @return \stdClass The stored data
*/
protected function get_data() {
$data = $this->raw_get('data');
Expand All @@ -338,7 +343,7 @@ protected function get_data() {
/**
* Return the file record base for use in the files table.
*
* @return array
* @return array|bool
*/
protected function get_file_record() {
$file = $this->get_sourcefile();
Expand Down
10 changes: 5 additions & 5 deletions files/classes/converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class converter {
/**
* Get a list of enabled plugins and classes.
*
* @return array
* @return array List of enabled plugins
*/
protected function get_enabled_plugins() {
$plugins = \core\plugininfo\fileconverter::get_enabled_plugins();
Expand All @@ -57,7 +57,7 @@ protected function get_enabled_plugins() {
*
* This allows for mocking of the file_storage API.
*
* @return file_storage
* @return \file_storage
*/
protected function get_file_storage() {
return get_file_storage();
Expand All @@ -69,7 +69,7 @@ protected function get_file_storage() {
* @param stored_file $file The file to convert
* @param string $format The desired target file format (file extension)
* @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) {
$conversions = conversion::get_conversions_for_file($file, $format);
Expand Down Expand Up @@ -160,7 +160,7 @@ public function poll_conversion(conversion $conversion) {
*
* @param array $converters The list of converters to try
* @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) {
if ($currentconverter) {
Expand Down Expand Up @@ -226,7 +226,7 @@ public function can_convert_storedfile_to(stored_file $file, $to) {

$from = \core_filetypes::get_file_extension($file->get_mimetype());
if (!$from) {
// No mimetype could be found. Unable to determine converter.
// No mime type could be found. Unable to determine converter.
return false;
}

Expand Down
1 change: 0 additions & 1 deletion files/classes/task/conversion_cleanup_task.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
Expand Down
10 changes: 5 additions & 5 deletions files/converter/unoconv/classes/converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
defined('MOODLE_INTERNAL') || die();

require_once($CFG->libdir . '/filelib.php');
use stored_file;

use stored_file;
use \core_files\conversion;

/**
Expand Down Expand Up @@ -118,9 +118,9 @@ public function start_document_conversion(\core_files\conversion $conversion) {
try {
// This function can either return false, or throw an exception so we need to handle both.
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;
}

Expand Down Expand Up @@ -169,7 +169,7 @@ public function poll_conversion_status(conversion $conversion) {
/**
* Generate and serve the test document.
*
* @return stored_file
* @return void
*/
public function serve_test_document() {
global $CFG;
Expand Down Expand Up @@ -267,7 +267,7 @@ protected static function is_minimum_version_met() {
/**
* Whether the plugin is fully configured.
*
* @return bool
* @return \stdClass
*/
public static function test_unoconv_path() {
global $CFG;
Expand Down
1 change: 0 additions & 1 deletion files/converter/unoconv/tests/converter_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

defined('MOODLE_INTERNAL') || die();


/**
* A set of tests for some of the unoconv functionality within Moodle.
*
Expand Down

0 comments on commit 92a951c

Please sign in to comment.