_DB = $databaseConnectionObject; $this->_User = $userObj; } /** * Validate given request string * * @param string $request * @return bool */ public function allowedRequests(string $request): bool { $ret = false; if(in_array($request, $this->_allowedRequests)) { $ret = true; } return $ret; } /** * With given data build the structure to create a add post * request * * @param array $data * @return array */ public function buildAddStructure(array $data): array { $ret = array(); if(!empty($data) && is_array($data)) { foreach($data as $k=>$v) { $ret[$k] = array('input' => $v['apiinfo']); } } return $ret; } /** * rewrite the data from curl into the format the * POST via web frontend creates * "The problem occurs when you have a form that uses both single file and HTML array feature." * * @param array $data * @return array */ public function prepareFilesArray(array $data): array { $ret = array(); if(!empty($data)) { foreach($data as $fieldName=>$fdata) { foreach($fdata as $k=>$v) { $ret[$k][$fieldName] = $v; } } } return $ret; } }