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

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