* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
class Site implements Serializable {
-
const TYPE_UNKNOWN = 'unknown';
const TYPE_MEDIAWIKI = 'mediawiki';
*
* @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
}
/**
- * Gets the type of the site (ie wikipedia).
+ * Gets the group of the site (ie wikipedia).
*
* @since 1.21
*
}
/**
- * Sets the type of the site (ie wikipedia).
+ * Sets the group of the site (ie wikipedia).
*
* @since 1.21
*
*
* @since 1.21
*
- * @return boolean
+ * @return bool
*/
public function shouldForward() {
return $this->forward;
*
* @since 1.21
*
- * @param boolean $shouldForward
+ * @param bool $shouldForward
*
* @throws MWException
*/
}
/**
- * 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
*
*
* @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();
*/
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] ) ) {
* @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]
+ : [];
}
/**
* @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] :
+ [];
}
/**
}
if ( !array_key_exists( 'paths', $this->extraData ) ) {
- $this->extraData['paths'] = array();
+ $this->extraData['paths'] = [];
}
$this->extraData['paths'][$pathType] = $fullUrl;
* @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'] : [];
}
/**
* @return string
*/
public function serialize() {
- $fields = array(
+ $fields = [
'globalid' => $this->globalId,
'type' => $this->type,
'group' => $this->group,
'forward' => $this->forward,
'internalid' => $this->internalId,
- );
+ ];
return serialize( $fields );
}
$this->setForward( $fields['forward'] );
$this->setInternalId( $fields['internalid'] );
}
-
}
-
-/**
- * @deprecated
- */
-class SiteObject extends Site {}