PHPDoc, code styling and attribute types redefinitions to improve code quality as suggested by #scrutinizer

ofaj
Yannick Warnier 9 years ago
parent 675e3caf2e
commit 1faf3c08d0
  1. 24
      .scrutinizer.yml
  2. 7
      main/inc/lib/certificate.lib.php
  3. 6
      main/inc/lib/database.lib.php
  4. 2
      main/inc/lib/extra_field_value.lib.php
  5. 10
      main/inc/lib/fileUpload.lib.php
  6. 9
      main/inc/lib/myspace.lib.php
  7. 7
      main/inc/lib/nusoap/class.soap_parser.php
  8. 4
      main/inc/lib/pdf.lib.php
  9. 2
      main/inc/lib/pear/HTML/QuickForm/select.php
  10. 4
      main/inc/lib/phpmailer/class.phpmailer.php
  11. 2
      main/inc/lib/phpmailer/class.smtp.php

@ -27,18 +27,18 @@ filter:
- main/inc/lib/browser/*
- main/inc/lib/elfinder/*
- main/inc/lib/freemindflashbrowser/*
- main/inc/lib/kses-0.2.2
- main/inc/lib/mimetex
- main/inc/lib/nanogong
- main/inc/lib/pclzip
- main/inc/lib/pear
- main/inc/lib/phpmailer
- main/inc/lib/phpseclib
- main/inc/lib/svg-edit
- main/inc/lib/swfobject
- main/inc/lib/wami-recorder
- main/inc/lib/xajax
- main/auth/cas/lib/CAS
- main/inc/lib/kses-0.2.2/*
- main/inc/lib/mimetex/*
- main/inc/lib/nanogong/*
- main/inc/lib/pclzip/*
- main/inc/lib/pear/*
- main/inc/lib/phpmailer/*
- main/inc/lib/phpseclib/*
- main/inc/lib/svg-edit/*
- main/inc/lib/swfobject/*
- main/inc/lib/wami-recorder/*
- main/inc/lib/xajax/*
- main/auth/cas/lib/CAS/*
checks:
php:
code_rating: true

@ -49,8 +49,11 @@ class Certificate extends Model
unset($this->certificate_data);
if (isset($certificate_id)) {
$this->certificate_data = $this->get($certificate_id);
$this->user_id = $this->certificate_data['user_id'];
$certificate = $this->get($certificate_id);
if (!empty($certificate) && is_array($certificate)) {
$this->certificate_data = $certificate;
$this->user_id = $this->certificate_data['user_id'];
}
} else {
//Try with the current user
$this->user_id = api_get_user_id();

@ -477,6 +477,12 @@ class Database
* @example array('where'=> array('course_code LIKE "?%"'))
* @example array('where'=> array('type = ? AND category = ?' => array('setting', 'Plugins'))
* @example array('where'=> array('name = "Julio" AND lastname = "montoya"'))
* @param array $columns
* @param string $table_name
* @param array $conditions
* @param string $type_result
* @param string $option
* @return array
*/
public static function select($columns, $table_name, $conditions = array(), $type_result = 'all', $option = 'ASSOC')
{

@ -24,7 +24,7 @@ class ExtraFieldValue extends Model
'created_at',
'updated_at',
);
/** @var string session_id, course_code, user_id, question id */
/** @var ExtraField */
public $extraField;
/**

@ -765,11 +765,11 @@ function dir_total_space($dir_path)
* Note : some browsers don't send the MIME Type (e.g. Netscape 4).
* We don't have solution for this kind of situation
*
* @author - Hugues Peeters <peeters@ipm.ucl.ac.be>
* @author - Bert Vanderkimpen
* @param - file_name (string) - Name of the file
* @param - file_type (string) - Type of the file
* @return - file_name (string)
* @author Hugues Peeters <peeters@ipm.ucl.ac.be>
* @author Bert Vanderkimpen
* @param string $file_name Name of the file
* @param string $file_type Type of the file
* @return string File name
*/
function add_ext_on_mime($file_name, $file_type)
{

@ -2332,10 +2332,10 @@ class MySpace
/**
* Checks whether a username has been already subscribed in a session.
* @param string a given username
* @param array the array with the course list id
* @param the session id
* @return 0 if the user is not subscribed otherwise it returns the user_id of the given username
* @param string $username a given username
* @param array $course_list the array with the course list id
* @param int $id_session the session id
* @return int 0 if the user is not subscribed otherwise it returns the user_id of the given username
* @author Julio Montoya
*/
public static function user_available_in_session($username, $course_list, $id_session)
@ -2361,6 +2361,7 @@ class MySpace
return 0;
}
}
return 0;
}
/**

@ -26,7 +26,7 @@ class nusoap_parser extends nusoap_base
var $default_namespace = '';
var $namespaces = array();
var $message = array();
var $parent = '';
var $parent;
var $fault = false;
var $fault_code = '';
var $fault_str = '';
@ -51,7 +51,8 @@ class nusoap_parser extends nusoap_base
* @param string $xml SOAP message
* @param string $encoding character encoding scheme of message
* @param string $method method for which XML is parsed (unused?)
* @param string $decode_utf8 whether to decode UTF-8 to ISO-8859-1
* @param bool $decode_utf8 whether to decode UTF-8 to ISO-8859-1
* @return void|bool
* @access public
*/
function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
@ -74,7 +75,7 @@ class nusoap_parser extends nusoap_base
$this->debug($err);
if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
$this->setError($err);
return;
return false;
}
// when HTTP says ISO-8859-1 (the default) and XML says UTF-8 (the typical), assume the other endpoint is just sloppy and proceed
} else {

@ -766,7 +766,7 @@ class PDF
}
/**
* @param string $header html content
* @param array $header html content
*/
public function set_custom_header($header)
{
@ -774,7 +774,7 @@ class PDF
}
/**
* @param string $footer html content
* @param array $footer html content
*/
public function set_custom_footer($footer)
{

@ -49,7 +49,7 @@ class HTML_QuickForm_select extends HTML_QuickForm_element
/**
* Default values of the SELECT
*
* @var string
* @var array
* @since 1.0
* @access private
*/

@ -2013,7 +2013,9 @@ class PHPMailer {
/**
* Evaluates the message and returns modifications for inline images and backgrounds
* @access public
* @return $message
* @param string $message
* @param string $basedir
* @return void
*/
public function MsgHTML($message, $basedir = '') {
preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);

@ -89,7 +89,7 @@ class SMTP {
$this->error = null;
$this->helo_rply = null;
$this->do_debug = 0;
$this->do_debug = false;
}
/////////////////////////////////////////////////

Loading…
Cancel
Save