public function flattenTree(string $propertyName, array &$result, array $level = [], string $messageTypeFilter = null)
    {
        if (count($this->$propertyName) > 0) {
            $propertyPath = implode('.', $level);
            $result[$propertyPath] = $this->filterMessages($this->$propertyName, $messageTypeFilter);
        }
        /** @var Result $subResult */
        foreach ($this->propertyResults as $subPropertyName => $subResult) {
            array_push($level, $subPropertyName);
            $subResult->flattenTree($propertyName, $result, $level, $messageTypeFilter);
            array_pop($level);
        }
    }
public function flattenTree(string $propertyName, array &$result, array $level = [], string $messageTypeFilter = null)
    {
        if (count($this->$propertyName) > 0) {
            $propertyPath = implode('.', $level);
            $result[$propertyPath] = $this->filterMessages($this->$propertyName, $messageTypeFilter);
        }
        /** @var Result $subResult */
        foreach ($this->propertyResults as $subPropertyName => $subResult) {
            array_push($level, $subPropertyName);
            $subResult->flattenTree($propertyName, $result, $level, $messageTypeFilter);
            array_pop($level);
        }
    }
public function flattenTree ( string $ propertyName , array & $ result , array $ level = [ ] , string $ messageTypeFilter = null ) { if ( count ( $ this -> $ propertyName ) > 0 ) { $ propertyPath = implode ( '.' , $ level ) ; $ result [ $ propertyPath ] = $ this -> filterMessages ( $ this -> $ propertyName , $ messageTypeFilter ) ; } /** @var Result $subResult */ foreach ( $ this -> propertyResults as $ subPropertyName => $ subResult ) { array_push ( $ level , $ subPropertyName ) ; $ subResult -> flattenTree ( $ propertyName , $ result , $ level , $ messageTypeFilter ) ; array_pop ( $ level ) ; } }
Flatten a tree of Result objects, based on a certain property.

@param string $propertyName
@param array $result The current result to be flattened
@param array $level The property path in the format array('level1', 'level2', ...) for recursion
@param string $messageTypeFilter If specified only messages implementing the given class name are taken into account
@return void
Flatten a tree of Result objects based on a certain property .