get all innerhtml of shadow root tree

The goal is to collect all the html of all shadow-roots. Even when a shadow is a tree containing several new once. I want to collect all it's html. Just like when you use F12 then you can also see all the source. So far I get till the root:

<?php
// An example of using php-webdriver.

namespace Facebook\WebDriver;

use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;

require_once('vendor/autoload.php');

$host = 'http://localhost:9515';//chromedriver.exe
$capabilities = DesiredCapabilities::chrome();
$driver = RemoteWebDriver::create($host, $capabilities, 5000);

$driver->get('http://shop.polymer-project.org');

// adding cookie
$driver->manage()->deleteAllCookies();

$cookie = new Cookie('cookie_name', 'cookie_value');
$driver->manage()->addCookie($cookie);

$cookies = $driver->manage()->getCookies();
//print_r($cookies);

$driver->manage()->timeouts()->implicitlyWait(100);
// print the title of the current page
echo "The title is '" . $driver->getTitle() . "'\n";


$driver->executeScript('
var allNodes = document.getElementsByTagName(\'*\');
for (var i = 0; i < allNodes.length; i++) {
  if(allNodes[i].shadowRoot) {
    //alert(\'it works\'+i+allNodes[i].shadowRoot.innerHTML); 
  }
}
');
//$driver->quit();

?>

I get the code of the shadow root, but that one contains 3 more shadow-root's. How do I collect those and have the sourcecode of it.