Code Duplication    Length = 6-6 lines in 4 locations

lib/ActionResponse.php 1 location

@@ 27-32 (lines=6) @@
24
            'affected' => 0,
25
        ];
26
27
        if ($diff = array_diff(array_keys($options), array_keys($defaults))) {
28
            throw new \InvalidArgumentException(sprintf(
29
                'Unexpected keys for action response: "%s", valid keys: "%s"',
30
                implode('", "', $diff), implode('", "', array_keys($defaults))
31
            ));
32
        }
33
34
        $options = array_merge($defaults, $options);
35

lib/Grid.php 1 location

@@ 53-58 (lines=6) @@
50
            SelectColumn::INPUT_NAME,
51
        ];
52
53
        if ($diff = array_diff(array_keys($postData), $valid)) {
54
            throw new \InvalidArgumentException(sprintf(
55
                'Unexpected keys in POST: "%s", valid keys: "%s"',
56
                implode('", "', $diff), implode('", "', $valid)
57
            ));
58
        }
59
60
        if (!isset($postData[ActionBar::INPUT_NAME])) {
61
            throw new \InvalidArgumentException(sprintf(

lib/GridContext.php 1 location

@@ 34-39 (lines=6) @@
31
        ];
32
33
        // check for invalid keys
34
        if ($diff = array_diff(array_keys($options), array_keys($defaults))) {
35
            throw new \InvalidArgumentException(sprintf(
36
                'Invalid grid context options "%s". Valid options: "%s"',
37
                implode('", "', $diff), implode('", "', array_keys($defaults))
38
            ));
39
        }
40
41
        // set defaults
42
        $options = array_merge($defaults, $options);

lib/Metadata/Driver/ArrayDriver.php 1 location

@@ 145-150 (lines=6) @@
142
143
    private function resolveConfig(array $defaultConfig, array $config)
144
    {
145
        if ($diff = array_diff(array_keys($config), array_keys($defaultConfig))) {
146
            throw new \InvalidArgumentException(sprintf(
147
                'Invalid configuration keys "%s" for grid, valid keys: "%s"',
148
                implode('", "', $diff), implode('", "', array_keys($defaultConfig))
149
            ));
150
        }
151
152
        return array_merge($defaultConfig, $config);
153
    }