Code Duplication    Length = 18-18 lines in 2 locations

src/LIN3S/WPSymfonyForm/Admin/Storage/InMemoryStorage.php 1 location

@@ 112-129 (lines=18) @@
109
     *
110
     * @return int
111
     */
112
    private function sort($item1, $item2)
113
    {
114
        $orderBy = 'name';
115
        $order = 'asc';
116
117
        if (!empty($_GET['orderby'])) {
118
            $orderBy = $_GET['orderby'];
119
        }
120
        if (!empty($_GET['order'])) {
121
            $order = $_GET['order'];
122
        }
123
        $result = strcmp($item1[$orderBy], $item2[$orderBy]);
124
        if ('asc' === $order) {
125
            return $result;
126
        }
127
128
        return -$result;
129
    }
130
}
131

src/LIN3S/WPSymfonyForm/Admin/Storage/YamlStorage.php 1 location

@@ 111-128 (lines=18) @@
108
     *
109
     * @return int
110
     */
111
    private function sort($item1, $item2)
112
    {
113
        $orderBy = 'name';
114
        $order = 'asc';
115
116
        if (!empty($_GET['orderby'])) {
117
            $orderBy = $_GET['orderby'];
118
        }
119
        if (!empty($_GET['order'])) {
120
            $order = $_GET['order'];
121
        }
122
        $result = strcmp($item1[$orderBy], $item2[$orderBy]);
123
        if ('asc' === $order) {
124
            return $result;
125
        }
126
127
        return -$result;
128
    }
129
}
130