picqer-php icon indicating copy to clipboard operation
picqer-php copied to clipboard

Undefined array key "data"

Open jeroen-hso opened this issue 2 years ago • 0 comments

    public function getCustomerByCustomerid($customerid)
    {
        $result = $this->sendRequest('/customers?customerid=' . urlencode($customerid));
        if (is_array($result['data']) && count($result['data']) == 1) {
            $result['data'] = $result['data'][0];
        } else {
            $result['data'] = null;
        }
        return $result;
    }

    public function getProductByProductcode($productcode)
    {
        $result = $this->sendRequest('/products?productcode=' . urlencode($productcode));

        if (is_array($result['data']) && count($result['data']) == 1) {
            $result['data'] = $result['data'][0];
        } else {
            $result['data'] = null;
        }

        return $result;
    }

Dumps when data is not defined

jeroen-hso avatar Oct 12 '23 12:10 jeroen-hso