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

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