public getPortalInformations ( $environment, array | null $types = null ) : |
||
$environment | string The environment to deliver | |
$types | array | null | Defines which typr of portals are requested (null for all) |
return |
public function getPortalInformations($environment, $types = null)
{
if (!isset($this->portalInformations[$environment])) {
throw new \InvalidArgumentException(sprintf('Unknown portal environment "%s"', $environment));
}
if ($types === null) {
return $this->portalInformations[$environment];
}
return array_filter($this->portalInformations[$environment], function (PortalInformation $portalInformation) use($types) {
return in_array($portalInformation->getType(), $types);
});
}
/** * @expectedException \InvalidArgumentException * @expectedExceptionMessage Unknown portal environment "unknown" */ public function testGetPortalInformationsUnknown() { $this->webspaceCollection->getPortalInformations('unknown'); }