X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fsite%2FHashSiteStore.php;h=f0a6e54e39ecffae5aeaefb5b0855ea27c89ca98;hb=f96aaf6833d052d10d46af47540fff995362433e;hp=2c2547210a76b1d1fb8538c6718a55dd662c8f67;hpb=3368cccde53732c1278f51632e69b9865c4ee6ba;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/site/HashSiteStore.php b/includes/site/HashSiteStore.php index 2c2547210a..f0a6e54e39 100644 --- a/includes/site/HashSiteStore.php +++ b/includes/site/HashSiteStore.php @@ -34,12 +34,12 @@ class HashSiteStore implements SiteStore { /** * @var Site[] */ - private $sites = array(); + private $sites = []; /** - * @param array $sites + * @param Site[] $sites */ - public function __construct( $sites = array() ) { + public function __construct( $sites = [] ) { $this->saveSites( $sites ); } @@ -50,7 +50,7 @@ class HashSiteStore implements SiteStore { * * @param Site $site * - * @return boolean Success indicator + * @return bool Success indicator */ public function saveSite( Site $site ) { $this->sites[$site->getGlobalId()] = $site; @@ -65,7 +65,7 @@ class HashSiteStore implements SiteStore { * * @param Site[] $sites * - * @return boolean Success indicator + * @return bool Success indicator */ public function saveSites( array $sites ) { foreach ( $sites as $site ) { @@ -87,11 +87,7 @@ class HashSiteStore implements SiteStore { * @return Site|null */ public function getSite( $globalId, $source = 'cache' ) { - if ( isset( $this->sites[$globalId] ) ) { - return $this->sites[$globalId]; - } else { - return null; - } + return $this->sites[$globalId] ?? null; } /** @@ -113,9 +109,10 @@ class HashSiteStore implements SiteStore { /** * Deletes all sites from the database. After calling clear(), getSites() will return an empty * list and getSite() will return null until saveSite() or saveSites() is called. + * @return bool */ public function clear() { - $this->sites = array(); + $this->sites = []; return true; }