toArray() public method

Returns the content of these portals as array.
public toArray ( ) : array
return array
 /**
  * Creates a new class with the data from the given collection.
  *
  * @param array $options
  *
  * @return string
  */
 public function dump($options = [])
 {
     return $this->render('WebspaceCollectionClass.php.twig', ['cache_class' => $options['cache_class'], 'base_class' => $options['base_class'], 'collection' => $this->webspaceCollection->toArray()]);
 }
 public function testToArray()
 {
     $collectionArray = $this->webspaceCollection->toArray();
     $webspace = $collectionArray['webspaces'][0];
     $this->assertEquals('Default', $webspace['name']);
     $this->assertEquals('default', $webspace['key']);
     $this->assertEquals('us', $webspace['localizations'][0]['country']);
     $this->assertEquals('en', $webspace['localizations'][0]['language']);
     $this->assertEquals(true, $webspace['localizations'][0]['default']);
     $this->assertEquals('ca', $webspace['localizations'][0]['children'][0]['country']);
     $this->assertEquals('en', $webspace['localizations'][0]['children'][0]['language']);
     $this->assertEquals(false, $webspace['localizations'][0]['children'][0]['default']);
     $this->assertEquals('ca', $webspace['localizations'][1]['country']);
     $this->assertEquals('fr', $webspace['localizations'][1]['language']);
     $this->assertEquals(false, $webspace['localizations'][1]['default']);
     $this->assertEquals('Summer', $webspace['segments'][0]['name']);
     $this->assertEquals('s', $webspace['segments'][0]['key']);
     $this->assertEquals(true, $webspace['segments'][0]['default']);
     $this->assertEquals('Winter', $webspace['segments'][1]['name']);
     $this->assertEquals('w', $webspace['segments'][1]['key']);
     $this->assertEquals(false, $webspace['segments'][1]['default']);
     $this->assertEquals('portal1theme', $webspace['theme']['key']);
     $this->assertEquals(1, count($webspace['navigation']));
     $this->assertEquals(1, count($webspace['navigation']['contexts']));
     $this->assertEquals('main', $webspace['navigation']['contexts'][0]['key']);
     $this->assertEquals([], $webspace['navigation']['contexts'][0]['metadata']);
     $portal = $webspace['portals'][0];
     $this->assertEquals('Portal1', $portal['name']);
     $this->assertEquals('portal1', $portal['key']);
     $this->assertEquals('prod', $portal['environments'][0]['type']);
     $this->assertEquals('www.portal1.com', $portal['environments'][0]['urls'][0]['url']);
     $this->assertEquals('en', $portal['environments'][0]['urls'][0]['language']);
     $this->assertEquals('us', $portal['environments'][0]['urls'][0]['country']);
     $this->assertEquals(null, $portal['environments'][0]['urls'][0]['segment']);
     $this->assertEquals(null, $portal['environments'][0]['urls'][0]['redirect']);
     $this->assertEquals('portal1.com', $portal['environments'][0]['urls'][1]['url']);
     $this->assertEquals('www.portal1.com', $portal['environments'][0]['urls'][1]['redirect']);
     $this->assertEquals('us', $portal['localizations'][0]['country']);
     $this->assertEquals('en', $portal['localizations'][0]['language']);
     $this->assertEquals(true, $portal['localizations'][0]['default']);
     $this->assertEquals('ca', $portal['localizations'][1]['country']);
     $this->assertEquals('en', $portal['localizations'][1]['language']);
     $this->assertEquals(false, $portal['localizations'][1]['default']);
     $this->assertEquals('ca', $portal['localizations'][2]['country']);
     $this->assertEquals('fr', $portal['localizations'][2]['language']);
     $this->assertEquals(false, $portal['localizations'][2]['default']);
     $this->assertEquals('tree', $portal['resourceLocator']['strategy']);
     $portalInformation = $collectionArray['portalInformations']['prod']['www.portal1.com'];
     $this->assertEquals(RequestAnalyzerInterface::MATCH_TYPE_FULL, $portalInformation['type']);
     $this->assertEquals('default', $portalInformation['webspace']);
     $this->assertEquals('portal1', $portalInformation['portal']);
     $this->assertEquals('en_us', $portalInformation['localization']['localization']);
     $this->assertEquals('s', $portalInformation['segment']);
     $this->assertEquals('www.portal1.com', $portalInformation['url']);
     $portalInformation = $collectionArray['portalInformations']['dev']['portal1.lo'];
     $this->assertEquals(RequestAnalyzerInterface::MATCH_TYPE_FULL, $portalInformation['type']);
     $this->assertEquals('default', $portalInformation['webspace']);
     $this->assertEquals('portal1', $portalInformation['portal']);
     $this->assertEquals('en_us', $portalInformation['localization']['localization']);
     $this->assertEquals('s', $portalInformation['segment']);
     $this->assertEquals('portal1.lo', $portalInformation['url']);
 }