private function constructString(array $components)
    {
        $formats = array_keys($components);
        $values = array_values($components);
        $keys = array_keys(array_filter($values, 'strlen'));

        return array_reduce($keys, function ($string, $key) use ($formats, $values) {
            return sprintf($formats[$key], $string, $values[$key]);
        }, '');
    }
private function constructString(array $components)
    {
        $formats = array_keys($components);
        $values = array_values($components);
        $keys = array_keys(array_filter($values, 'strlen'));

        return array_reduce($keys, function ($string, $key) use ($formats, $values) {
            return sprintf($formats[$key], $string, $values[$key]);
        }, '');
    }
private function constructString ( array $ components ) { $ formats = array_keys ( $ components ) ; $ values = array_values ( $ components ) ; $ keys = array_keys ( array_filter ( $ values , 'strlen' ) ) ; return array_reduce ( $ keys , function ( $ string , $ key ) use ( $ formats , $ values ) { return sprintf ( $ formats [ $ key ] , $ string , $ values [ $ key ] ) ; } , '' ) ; }
Constructs the string from the non empty parts with specific formats.
@param array $components Associative array of formats and values
@return string The constructed string
Constructs the string from the non empty parts with specific formats .