Code Duplication    Length = 8-11 lines in 2 locations

src/Data/Cast.php 2 locations

@@ 59-66 (lines=8) @@
56
            if (is_array($value) && ArrHelper::isStrKeysArray($value)) {
57
                foreach ($value as $key => $val) {
58
                    $method = $this->config[$field][$key] ?? null;
59
                    if (empty($method) || $val === null) {
60
                        $casted[$field][$key] = $val;
61
                    } else {
62
                        if (!method_exists($this, $method)) {
63
                            throw new ConfigurationException('unknown field type: ' . $method);
64
                        }
65
                        $casted[$field][$key] = call_user_func([$this, $method], $value);
66
                    }
67
                }
68
            } else {
69
                $method = $this->config[$field] ?? null;
@@ 68-78 (lines=11) @@
65
                        $casted[$field][$key] = call_user_func([$this, $method], $value);
66
                    }
67
                }
68
            } else {
69
                $method = $this->config[$field] ?? null;
70
                if (empty($method) || $value === null) {
71
                    $casted[$field] = $value;
72
                } else {
73
                    if (!method_exists($this, $method)) {
74
                        throw new ConfigurationException('unknown field type: ' . $method);
75
                    }
76
                    $casted[$field] = call_user_func([$this, $method], $value);
77
                }
78
            }
79
        }
80
        return $casted;
81
    }