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/browser/*
- main/inc/lib/elfinder/* - main/inc/lib/elfinder/*
- main/inc/lib/freemindflashbrowser/* - main/inc/lib/freemindflashbrowser/*
- main/inc/lib/kses-0.2.2 - main/inc/lib/kses-0.2.2/*
- main/inc/lib/mimetex - main/inc/lib/mimetex/*
- main/inc/lib/nanogong - main/inc/lib/nanogong/*
- main/inc/lib/pclzip - main/inc/lib/pclzip/*
- main/inc/lib/pear - main/inc/lib/pear/*
- main/inc/lib/phpmailer - main/inc/lib/phpmailer/*
- main/inc/lib/phpseclib - main/inc/lib/phpseclib/*
- main/inc/lib/svg-edit - main/inc/lib/svg-edit/*
- main/inc/lib/swfobject - main/inc/lib/swfobject/*
- main/inc/lib/wami-recorder - main/inc/lib/wami-recorder/*
- main/inc/lib/xajax - main/inc/lib/xajax/*
- main/auth/cas/lib/CAS - main/auth/cas/lib/CAS/*
checks: checks:
php: php:
code_rating: true code_rating: true

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

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

@ -24,7 +24,7 @@ class ExtraFieldValue extends Model
'created_at', 'created_at',
'updated_at', 'updated_at',
); );
/** @var string session_id, course_code, user_id, question id */ /** @var ExtraField */
public $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). * Note : some browsers don't send the MIME Type (e.g. Netscape 4).
* We don't have solution for this kind of situation * We don't have solution for this kind of situation
* *
* @author - Hugues Peeters <peeters@ipm.ucl.ac.be> * @author Hugues Peeters <peeters@ipm.ucl.ac.be>
* @author - Bert Vanderkimpen * @author Bert Vanderkimpen
* @param - file_name (string) - Name of the file * @param string $file_name Name of the file
* @param - file_type (string) - Type of the file * @param string $file_type Type of the file
* @return - file_name (string) * @return string File name
*/ */
function add_ext_on_mime($file_name, $file_type) 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. * Checks whether a username has been already subscribed in a session.
* @param string a given username * @param string $username a given username
* @param array the array with the course list id * @param array $course_list the array with the course list id
* @param the session id * @param int $id_session the session id
* @return 0 if the user is not subscribed otherwise it returns the user_id of the given username * @return int 0 if the user is not subscribed otherwise it returns the user_id of the given username
* @author Julio Montoya * @author Julio Montoya
*/ */
public static function user_available_in_session($username, $course_list, $id_session) public static function user_available_in_session($username, $course_list, $id_session)
@ -2361,6 +2361,7 @@ class MySpace
return 0; return 0;
} }
} }
return 0;
} }
/** /**

@ -26,7 +26,7 @@ class nusoap_parser extends nusoap_base
var $default_namespace = ''; var $default_namespace = '';
var $namespaces = array(); var $namespaces = array();
var $message = array(); var $message = array();
var $parent = ''; var $parent;
var $fault = false; var $fault = false;
var $fault_code = ''; var $fault_code = '';
var $fault_str = ''; var $fault_str = '';
@ -51,7 +51,8 @@ class nusoap_parser extends nusoap_base
* @param string $xml SOAP message * @param string $xml SOAP message
* @param string $encoding character encoding scheme of message * @param string $encoding character encoding scheme of message
* @param string $method method for which XML is parsed (unused?) * @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 * @access public
*/ */
function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){ function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
@ -74,7 +75,7 @@ class nusoap_parser extends nusoap_base
$this->debug($err); $this->debug($err);
if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') { if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') {
$this->setError($err); $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 // 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 { } else {

@ -766,7 +766,7 @@ class PDF
} }
/** /**
* @param string $header html content * @param array $header html content
*/ */
public function set_custom_header($header) 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) public function set_custom_footer($footer)
{ {

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

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

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

Loading…
Cancel
Save