src/Translate.php
public function localizeDeepArray(?array $arr, string $group, int $depth = 1, ?string $lang = null): ?array
    {
        if ($arr === null) {
            return null;
        }
        
        if ($depth < 0) {
            throw new \InvalidArgumentException("Depth must be a non-negative integer, $depth given");
        }
        
        if ($depth) {
            foreach ($arr as $key => &$value) {
                if (!is_array($value)) {
                    throw new \LengthException("Exceeded depth when localizing deep array");
                }
                $value = $this->localizeDeepArray($value, $group, $depth - 1, $lang);
            }
            unset($value);
            return $arr;
        }
        
        return $this->flatten($arr, $group, $lang);
    }
public function localizeDeepArray(?array $arr, string $group, int $depth = 1, ?string $lang = null): ?array
    {
        if ($arr === null) {
            return null;
        }
        
        if ($depth < 0) {
            throw new \InvalidArgumentException("Depth must be a non-negative integer, $depth given");
        }
        
        if ($depth) {
            foreach ($arr as $key => &$value) {
                if (!is_array($value)) {
                    throw new \LengthException("Exceeded depth when localizing deep array");
                }
                $value = $this->localizeDeepArray($value, $group, $depth - 1, $lang);
            }
            unset($value);
            return $arr;
        }
        
        return $this->flatten($arr, $group, $lang);
    }
public function localizeDeepArray ( ? array $ arr , string $ group , int $ depth = 1 , ? string $ lang = null ) : ? array { if ( $ arr === null ) { return null ; } if ( $ depth < 0 ) { throw new \ InvalidArgumentException ( "Depth must be a non-negative integer, $depth given" ) ; } if ( $ depth ) { foreach ( $ arr as $ key => & $ value ) { if ( ! is_array ( $ value ) ) { throw new \ LengthException ( "Exceeded depth when localizing deep array" ) ; } $ value = $ this -> localizeDeepArray ( $ value , $ group , $ depth - 1 , $ lang ) ; } unset ( $ value ) ; return $ arr ; } return $ this -> flatten ( $ arr , $ group , $ lang ) ; }
Localizes a multidimensional array
@param array $arr The array to localize
@param string $group The name of the group of fields to flatten
@param int $depth The depth of the array
@param string $lang The output language. Default is default language.
@return array
Localizes a multidimensional array