forked from Wavyzz/dolibarr
Clean code
This commit is contained in:
@@ -32,13 +32,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
*/
|
||||
class Documents extends DolibarrApi
|
||||
{
|
||||
/**
|
||||
* @var array $DOCUMENT_FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
public static $DOCUMENT_FIELDS = array(
|
||||
'modulepart'
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -993,25 +986,4 @@ class Documents extends DolibarrApi
|
||||
|
||||
throw new RestException(403);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName
|
||||
/**
|
||||
* Validate fields before create or update object
|
||||
*
|
||||
* @param array $data Array with data to verify
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _validate_file($data)
|
||||
{
|
||||
// phpcs:enable
|
||||
$result = array();
|
||||
foreach (Documents::$DOCUMENT_FIELDS as $field) {
|
||||
if (!isset($data[$field])) {
|
||||
throw new RestException(400, "$field field missing");
|
||||
}
|
||||
$result[$field] = $data[$field];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user