Sulu\Component\Webspace\Manager\WebspaceCollection::getPortalInformations PHP Метод

getPortalInformations() публичный Метод

Returns the portal informations for the given environment.
public getPortalInformations ( $environment, array | null $types = null ) : PortalInformation[]
$environment string The environment to deliver
$types array | null Defines which typr of portals are requested (null for all)
Результат Sulu\Component\Webspace\PortalInformation[]
    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);
        });
    }

Usage Example

Пример #1
0
 /**
  * @expectedException \InvalidArgumentException
  * @expectedExceptionMessage Unknown portal environment "unknown"
  */
 public function testGetPortalInformationsUnknown()
 {
     $this->webspaceCollection->getPortalInformations('unknown');
 }