public function validate(
        array $divisionData,
        string $filename,
        array &$allDivisions = [],
        bool $isCore = false
    ) : void {
        Assertion::keyExists($divisionData, 'division', 'required attibute "division" is missing in File ' . $filename);
        Assertion::string($divisionData['division'], 'required attibute "division" has to be a string in File ' . $filename);

        Assertion::keyExists($divisionData, 'sortIndex', 'required attibute "sortIndex" is missing in File ' . $filename);
        Assertion::integer($divisionData['sortIndex'], 'required attibute "sortIndex" has to be a integer in File ' . $filename);

        if (!$isCore) {
            Assertion::greaterThan($divisionData['sortIndex'], 0, 'required attibute "sortIndex" has to be a positive integer in File ' . $filename);
        }

        Assertion::keyExists($divisionData, 'lite', 'required attibute "lite" is missing in File ' . $filename);
        Assertion::boolean($divisionData['lite'], 'required attibute "lite" has to be an boolean in File ' . $filename);

        Assertion::keyExists($divisionData, 'standard', 'required attibute "standard" is missing in File ' . $filename);
        Assertion::boolean($divisionData['standard'], 'required attibute "standard" has to be an boolean in File ' . $filename);

        Assertion::keyExists($divisionData, 'userAgents', 'required attibute "userAgents" is missing in File ' . $filename);
        Assertion::isArray($divisionData['userAgents'], 'required attibute "userAgents" should be an array in File ' . $filename);
        Assertion::notEmpty($divisionData['userAgents'], 'required attibute "userAgents" should be an non-empty array in File ' . $filename);

        if (isset($divisionData['versions']) && is_array($divisionData['versions'])) {
            $versions = $divisionData['versions'];
        } else {
            $versions = ['0.0'];
        }

        foreach ($divisionData['userAgents'] as $index => $useragentData) {
            $this->validateUserAgentSection($useragentData, $versions, $allDivisions, $isCore, $filename, $index);

            $allDivisions[] = $useragentData['userAgent'];
        }
    }
public function validate(
        array $divisionData,
        string $filename,
        array &$allDivisions = [],
        bool $isCore = false
    ) : void {
        Assertion::keyExists($divisionData, 'division', 'required attibute "division" is missing in File ' . $filename);
        Assertion::string($divisionData['division'], 'required attibute "division" has to be a string in File ' . $filename);

        Assertion::keyExists($divisionData, 'sortIndex', 'required attibute "sortIndex" is missing in File ' . $filename);
        Assertion::integer($divisionData['sortIndex'], 'required attibute "sortIndex" has to be a integer in File ' . $filename);

        if (!$isCore) {
            Assertion::greaterThan($divisionData['sortIndex'], 0, 'required attibute "sortIndex" has to be a positive integer in File ' . $filename);
        }

        Assertion::keyExists($divisionData, 'lite', 'required attibute "lite" is missing in File ' . $filename);
        Assertion::boolean($divisionData['lite'], 'required attibute "lite" has to be an boolean in File ' . $filename);

        Assertion::keyExists($divisionData, 'standard', 'required attibute "standard" is missing in File ' . $filename);
        Assertion::boolean($divisionData['standard'], 'required attibute "standard" has to be an boolean in File ' . $filename);

        Assertion::keyExists($divisionData, 'userAgents', 'required attibute "userAgents" is missing in File ' . $filename);
        Assertion::isArray($divisionData['userAgents'], 'required attibute "userAgents" should be an array in File ' . $filename);
        Assertion::notEmpty($divisionData['userAgents'], 'required attibute "userAgents" should be an non-empty array in File ' . $filename);

        if (isset($divisionData['versions']) && is_array($divisionData['versions'])) {
            $versions = $divisionData['versions'];
        } else {
            $versions = ['0.0'];
        }

        foreach ($divisionData['userAgents'] as $index => $useragentData) {
            $this->validateUserAgentSection($useragentData, $versions, $allDivisions, $isCore, $filename, $index);

            $allDivisions[] = $useragentData['userAgent'];
        }
    }
public function validate ( array $ divisionData , string $ filename , array & $ allDivisions = [ ] , bool $ isCore = false ) : void { Assertion :: keyExists ( $ divisionData , 'division' , 'required attibute "division" is missing in File ' . $ filename ) ; Assertion :: string ( $ divisionData [ 'division' ] , 'required attibute "division" has to be a string in File ' . $ filename ) ; Assertion :: keyExists ( $ divisionData , 'sortIndex' , 'required attibute "sortIndex" is missing in File ' . $ filename ) ; Assertion :: integer ( $ divisionData [ 'sortIndex' ] , 'required attibute "sortIndex" has to be a integer in File ' . $ filename ) ; if ( ! $ isCore ) { Assertion :: greaterThan ( $ divisionData [ 'sortIndex' ] , 0 , 'required attibute "sortIndex" has to be a positive integer in File ' . $ filename ) ; } Assertion :: keyExists ( $ divisionData , 'lite' , 'required attibute "lite" is missing in File ' . $ filename ) ; Assertion :: boolean ( $ divisionData [ 'lite' ] , 'required attibute "lite" has to be an boolean in File ' . $ filename ) ; Assertion :: keyExists ( $ divisionData , 'standard' , 'required attibute "standard" is missing in File ' . $ filename ) ; Assertion :: boolean ( $ divisionData [ 'standard' ] , 'required attibute "standard" has to be an boolean in File ' . $ filename ) ; Assertion :: keyExists ( $ divisionData , 'userAgents' , 'required attibute "userAgents" is missing in File ' . $ filename ) ; Assertion :: isArray ( $ divisionData [ 'userAgents' ] , 'required attibute "userAgents" should be an array in File ' . $ filename ) ; Assertion :: notEmpty ( $ divisionData [ 'userAgents' ] , 'required attibute "userAgents" should be an non-empty array in File ' . $ filename ) ; if ( isset ( $ divisionData [ 'versions' ] ) && is_array ( $ divisionData [ 'versions' ] ) ) { $ versions = $ divisionData [ 'versions' ] ; } else { $ versions = [ '0.0' ] ; } foreach ( $ divisionData [ 'userAgents' ] as $ index => $ useragentData ) { $ this -> validateUserAgentSection ( $ useragentData , $ versions , $ allDivisions , $ isCore , $ filename , $ index ) ; $ allDivisions [ ] = $ useragentData [ 'userAgent' ] ; } }
valdates the structure of a division

@param array  $divisionData Data to validate
@param string $filename
@param array  $allDivisions
@param bool   $isCore

@throws \Assert\AssertionFailedException
@throws \LogicException
valdates the structure of a division