Code Duplication    Length = 17-18 lines in 2 locations

src/FrontQL/Adapter/Select/SelectAdapter.php 1 location

@@ 98-115 (lines=18) @@
95
     *
96
     * @return string
97
     */
98
    public function getOrder()
99
    {
100
        $allowed = ['ASC', 'DESC'];
101
102
        if(!isset($this->payload['order']) || !is_array($this->payload['order']))
103
            return '';
104
105
        $orders = array();
106
107
        foreach ($this->payload['order'] as $order)
108
        {
109
            $columns  = implode(', ', $order[0]);
110
            $command  = in_array($order[1], $allowed) ? $order[1] : 'ASC';
111
            $orders[] = "{$columns} {$command}";
112
        }
113
114
        return implode(', ', $orders);
115
    }
116
117
    /**
118
     * Retorna o where do payload de seleção

src/FrontQL/Adapter/Select/SelectPayload.php 1 location

@@ 98-114 (lines=17) @@
95
     *
96
     * @return string
97
     */
98
    public function getOrder()
99
    {
100
        $allowed = ['ASC', 'DESC'];
101
102
        if(!isset($this->payload['order']) || !is_array($this->payload['order']))
103
            return '';
104
105
        $orders = array();
106
107
        foreach ($this->payload['order'] as $order){
108
            $columns  = implode(', ', $order[0]);
109
            $command  = in_array($order[1], $allowed) ? $order[1] : 'ASC';
110
            $orders[] = "{$columns}, {$command}";
111
        }
112
113
        return implode(', ', $orders);
114
    }
115
116
    /**
117
     * Retorna o where do payload de seleção