public function addBrowserFile(string $filename) : void
    {
        $decodedFileContent = $this->loadFile($filename);

        Assertion::isArray($decodedFileContent, 'required "browsers" structure has to be an array');

        $browserFactory = new BrowserFactory();

        foreach (array_keys($decodedFileContent) as $browserName) {
            $browserData = $decodedFileContent[$browserName];
            $browserName = (string) $browserName;

            $this->collection->addBrowser($browserName, $browserFactory->build($browserData, $browserName));
        }
    }
public function addBrowserFile(string $filename) : void
    {
        $decodedFileContent = $this->loadFile($filename);

        Assertion::isArray($decodedFileContent, 'required "browsers" structure has to be an array');

        $browserFactory = new BrowserFactory();

        foreach (array_keys($decodedFileContent) as $browserName) {
            $browserData = $decodedFileContent[$browserName];
            $browserName = (string) $browserName;

            $this->collection->addBrowser($browserName, $browserFactory->build($browserData, $browserName));
        }
    }
public function addBrowserFile ( string $ filename ) : void { $ decodedFileContent = $ this -> loadFile ( $ filename ) ; Assertion :: isArray ( $ decodedFileContent , 'required "browsers" structure has to be an array' ) ; $ browserFactory = new BrowserFactory ( ) ; foreach ( array_keys ( $ decodedFileContent ) as $ browserName ) { $ browserData = $ decodedFileContent [ $ browserName ] ; $ browserName = ( string ) $ browserName ; $ this -> collection -> addBrowser ( $ browserName , $ browserFactory -> build ( $ browserData , $ browserName ) ) ; } }
Load a browsers.json file and parse it into the browsers data array, validates these data and creates a
collection of Browser objects

@param string $filename Name of the file

@throws \RuntimeException                if the file does not exist or has invalid JSON
@throws \Assert\AssertionFailedException
Load a browsers . json file and parse it into the browsers data array validates these data and creates a collection of Browser objects