Merge "RCFilters: Add 'advanced filters' label to the view selection"
[lhc/web/wiklou.git] / includes / Licenses.php
index e3db5b4..da1a8da 100644 (file)
  * A License class for use on Special:Upload
  */
 class Licenses extends HTMLFormField {
-       /**
-        * @var string
-        */
+       /** @var string */
        protected $msg;
 
-       /**
-        * @var array
-        */
-       protected $licenses = array();
+       /** @var array */
+       protected $licenses = [];
 
-       /**
-        * @var string
-        */
+       /** @var string */
        protected $html;
        /**#@-*/
 
        /**
-        * Constructor
-        *
         * @param array $params
         */
        public function __construct( $params ) {
                parent::__construct( $params );
 
-               $this->msg = empty( $params['licenses'] ) ? wfMessage( 'licenses' )->inContentLanguage()->plain() : $params['licenses'];
+               $this->msg = empty( $params['licenses'] )
+                       ? wfMessage( 'licenses' )->inContentLanguage()->plain()
+                       : $params['licenses'];
                $this->selected = null;
 
                $this->makeLicenses();
@@ -62,7 +56,7 @@ class Licenses extends HTMLFormField {
         * @private
         */
        protected function makeLicenses() {
-               $levels = array();
+               $levels = [];
                $lines = explode( "\n", $this->msg );
 
                foreach ( $lines as $line ) {
@@ -94,7 +88,7 @@ class Licenses extends HTMLFormField {
         */
        protected function trimStars( $str ) {
                $numStars = strspn( $str, '*' );
-               return array( $numStars, ltrim( substr( $str, $numStars ), ' ' ) );
+               return [ $numStars, ltrim( substr( $str, $numStars ), ' ' ) ];
        }
 
        /**
@@ -121,17 +115,17 @@ class Licenses extends HTMLFormField {
                        if ( is_array( $val ) ) {
                                $this->html .= $this->outputOption(
                                        $key, '',
-                                       array(
+                                       [
                                                'disabled' => 'disabled',
                                                'style' => 'color: GrayText', // for MSIE
-                                       ),
+                                       ],
                                        $depth
                                );
                                $this->makeHtml( $val, $depth + 1 );
                        } else {
                                $this->html .= $this->outputOption(
                                        $val->text, $val->template,
-                                       array( 'title' => '{{' . $val->template . '}}' ),
+                                       [ 'title' => '{{' . $val->template . '}}' ],
                                        $depth
                                );
                        }
@@ -179,13 +173,13 @@ class Licenses extends HTMLFormField {
                $this->selected = $value;
 
                $this->html = $this->outputOption( wfMessage( 'nolicense' )->text(), '',
-                       (bool)$this->selected ? null : array( 'selected' => 'selected' ) );
+                       (bool)$this->selected ? null : [ 'selected' => 'selected' ] );
                $this->makeHtml( $this->getLicenses() );
 
-               $attribs = array(
+               $attribs = [
                        'name' => $this->mName,
                        'id' => $this->mID
-               );
+               ];
                if ( !empty( $this->mParams['disabled'] ) ) {
                        $attibs['disabled'] = 'disabled';
                }
@@ -198,20 +192,14 @@ class Licenses extends HTMLFormField {
  * A License class for use on Special:Upload (represents a single type of license).
  */
 class License {
-       /**
-        * @var string
-        */
-       var $template;
+       /** @var string */
+       public $template;
 
-       /**
-        * @var string
-        */
-       var $text;
+       /** @var string */
+       public $text;
 
        /**
-        * Constructor
-        *
-        * @param string $str license name??
+        * @param string $str License name??
         */
        function __construct( $str ) {
                list( $text, $template ) = explode( '|', strrev( $str ), 2 );