Merge "Make wgDisableAnonTalk disable anon links in automatic edit summaries"
[lhc/web/wiklou.git] / includes / specials / helpers / License.php
index 4f94b4d..fbd801d 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup SpecialPage
  * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
  * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
- * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ * @license GPL-2.0-or-later
  */
 
 /**
@@ -35,12 +35,27 @@ class License {
        public $text;
 
        /**
-        * @param string $str License name??
+        * @param string $str
         */
-       function __construct( $str ) {
-               list( $text, $template ) = explode( '|', strrev( $str ), 2 );
+       public function __construct( $str ) {
+               $str = $this->parse( $str );
+               list( $this->template, $this->text ) = $this->split( $str );
+       }
 
-               $this->template = strrev( $template );
-               $this->text = strrev( $text );
+       /**
+        * @param string $str
+        * @return string
+        */
+       protected function parse( $str ) {
+               return $str;
+       }
+
+       /**
+        * @param string $str
+        * @return string[] Array with [template, text]
+        */
+       protected function split( $str ) {
+               list( $text, $template ) = explode( '|', strrev( $str ), 2 );
+               return [ strrev( $template ), strrev( $text ) ];
        }
 }