private function postFields($data) { if (is_array($data)) { if (helpers\ArrayHelper::isMultidimensional($data)) { $data = helpers\HttpHelper::httpBuildMultiQuery($data); } else { foreach ($data as $key => $value) { // Fix "Notice: Array to string conversion" when $value in // curl_setopt($ch, CURLOPT_POSTFIELDS, $value) is an array // that contains an empty array. if (is_array($value) && empty($value)) { $data[$key] = ''; // Fix "curl_setopt(): The usage of the @filename API for // file uploading is deprecated. Please use the CURLFile // class instead". } elseif (is_string($value) && strpos($value, '@') === 0) { if (class_exists('CURLFile')) { $data[$key] = new \CURLFile(substr($value, 1)); } } } } } return $data; }
public function testArrayIndexed() { $this->assertFalse(ArrayHelper::isAssociativeArray(['wibble', 'wubble', 'wobble'])); }