Merge "registration: Fix mode of files (755 -> 644)"
[lhc/web/wiklou.git] / includes / site / Site.php
index 076dc88..6a97a50 100644 (file)
@@ -27,7 +27,6 @@
  * @author Jeroen De Dauw < jeroendedauw@gmail.com >
  */
 class Site implements Serializable {
-
        const TYPE_UNKNOWN = 'unknown';
        const TYPE_MEDIAWIKI = 'mediawiki';
 
@@ -92,21 +91,21 @@ class Site implements Serializable {
         *
         * @var array[]
         */
-       protected $localIds = array();
+       protected $localIds = [];
 
        /**
         * @since 1.21
         *
         * @var array
         */
-       protected $extraData = array();
+       protected $extraData = [];
 
        /**
         * @since 1.21
         *
         * @var array
         */
-       protected $extraConfig = array();
+       protected $extraConfig = [];
 
        /**
         * @since 1.21
@@ -173,7 +172,7 @@ class Site implements Serializable {
        }
 
        /**
-        * Gets the type of the site (ie wikipedia).
+        * Gets the group of the site (ie wikipedia).
         *
         * @since 1.21
         *
@@ -184,7 +183,7 @@ class Site implements Serializable {
        }
 
        /**
-        * Sets the type of the site (ie wikipedia).
+        * Sets the group of the site (ie wikipedia).
         *
         * @since 1.21
         *
@@ -234,7 +233,7 @@ class Site implements Serializable {
         *
         * @since 1.21
         *
-        * @return boolean
+        * @return bool
         */
        public function shouldForward() {
                return $this->forward;
@@ -246,7 +245,7 @@ class Site implements Serializable {
         *
         * @since 1.21
         *
-        * @param boolean $shouldForward
+        * @param bool $shouldForward
         *
         * @throws MWException
         */
@@ -340,11 +339,12 @@ class Site implements Serializable {
        }
 
        /**
-        * Returns the main path type, that is the type of the path that should generally be used to construct links
-        * to the target site.
+        * Returns the main path type, that is the type of the path that should
+        * generally be used to construct links to the target site.
         *
-        * This default implementation returns Site::PATH_LINK as the default path type. Subclasses can override this
-        * to define a different default path type, or return false to disable site links.
+        * This default implementation returns Site::PATH_LINK as the default path
+        * type. Subclasses can override this to define a different default path
+        * type, or return false to disable site links.
         *
         * @since 1.21
         *
@@ -365,9 +365,9 @@ class Site implements Serializable {
         *
         * @since 1.21
         *
-        * @param bool|String $pageName
+        * @param bool|string $pageName
         *
-        * @return string|boolean false
+        * @return string|bool
         */
        public function getPageUrl( $pageName = false ) {
                $url = $this->getLinkPath();
@@ -499,11 +499,11 @@ class Site implements Serializable {
         */
        public function addLocalId( $type, $identifier ) {
                if ( $this->localIds === false ) {
-                       $this->localIds = array();
+                       $this->localIds = [];
                }
 
                if ( !array_key_exists( $type, $this->localIds ) ) {
-                       $this->localIds[$type] = array();
+                       $this->localIds[$type] = [];
                }
 
                if ( !in_array( $identifier, $this->localIds[$type] ) ) {
@@ -541,7 +541,9 @@ class Site implements Serializable {
         * @return string[]
         */
        public function getInterwikiIds() {
-               return array_key_exists( self::ID_INTERWIKI, $this->localIds ) ? $this->localIds[self::ID_INTERWIKI] : array();
+               return array_key_exists( self::ID_INTERWIKI, $this->localIds )
+                       ? $this->localIds[self::ID_INTERWIKI]
+                       : [];
        }
 
        /**
@@ -553,7 +555,9 @@ class Site implements Serializable {
         * @return string[]
         */
        public function getNavigationIds() {
-               return array_key_exists( self::ID_EQUIVALENT, $this->localIds ) ? $this->localIds[self::ID_EQUIVALENT] : array();
+               return array_key_exists( self::ID_EQUIVALENT, $this->localIds )
+                       ? $this->localIds[self::ID_EQUIVALENT] :
+                       [];
        }
 
        /**
@@ -584,7 +588,7 @@ class Site implements Serializable {
                }
 
                if ( !array_key_exists( 'paths', $this->extraData ) ) {
-                       $this->extraData['paths'] = array();
+                       $this->extraData['paths'] = [];
                }
 
                $this->extraData['paths'][$pathType] = $fullUrl;
@@ -613,7 +617,7 @@ class Site implements Serializable {
         * @return string[]
         */
        public function getAllPaths() {
-               return array_key_exists( 'paths', $this->extraData ) ? $this->extraData['paths'] : array();
+               return array_key_exists( 'paths', $this->extraData ) ? $this->extraData['paths'] : [];
        }
 
        /**
@@ -654,7 +658,7 @@ class Site implements Serializable {
         * @return string
         */
        public function serialize() {
-               $fields = array(
+               $fields = [
                        'globalid' => $this->globalId,
                        'type' => $this->type,
                        'group' => $this->group,
@@ -666,7 +670,7 @@ class Site implements Serializable {
                        'forward' => $this->forward,
                        'internalid' => $this->internalId,
 
-               );
+               ];
 
                return serialize( $fields );
        }
@@ -693,10 +697,4 @@ class Site implements Serializable {
                $this->setForward( $fields['forward'] );
                $this->setInternalId( $fields['internalid'] );
        }
-
 }
-
-/**
- * @deprecated
- */
-class SiteObject extends Site {}