Code Duplication    Length = 18-18 lines in 2 locations

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

@@ 119-136 (lines=18) @@
116
     *
117
     * @return int
118
     */
119
    private function sort($item1, $item2)
120
    {
121
        $orderBy = 'name';
122
        $order = 'asc';
123
124
        if (!empty($_GET['orderby'])) {
125
            $orderBy = $_GET['orderby'];
126
        }
127
        if (!empty($_GET['order'])) {
128
            $order = $_GET['order'];
129
        }
130
        $result = strcmp($item1[$orderBy], $item2[$orderBy]);
131
        if ('asc' === $order) {
132
            return $result;
133
        }
134
135
        return -$result;
136
    }
137
}
138

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

@@ 134-151 (lines=18) @@
131
     *
132
     * @return int
133
     */
134
    private function sort($item1, $item2)
135
    {
136
        $orderBy = 'name';
137
        $order = 'asc';
138
139
        if (!empty($_GET['orderby'])) {
140
            $orderBy = $_GET['orderby'];
141
        }
142
        if (!empty($_GET['order'])) {
143
            $order = $_GET['order'];
144
        }
145
        $result = strcmp($item1[$orderBy], $item2[$orderBy]);
146
        if ('asc' === $order) {
147
            return $result;
148
        }
149
150
        return -$result;
151
    }
152
}
153