Apply fixes from StyleCI
This commit is contained in:
@@ -151,6 +151,7 @@ function faveotime($date, $hour = 0, $min = 0, $sec = 0)
|
||||
* @category function to return array values if status id
|
||||
*
|
||||
* @param string purpose of status
|
||||
*
|
||||
* @return array ids of status with purpose passed as string
|
||||
*/
|
||||
function getStatusArray($status)
|
||||
@@ -165,6 +166,7 @@ function getStatusArray($status)
|
||||
* @category function to UTF encoding
|
||||
*
|
||||
* @param string name
|
||||
*
|
||||
* @return string name
|
||||
*/
|
||||
function utfEncoding($name)
|
||||
@@ -183,20 +185,20 @@ function utfEncoding($name)
|
||||
|
||||
function faveoDate($date = '', $format = '', $tz = '')
|
||||
{
|
||||
if (! $date) {
|
||||
if (!$date) {
|
||||
$date = \Carbon\Carbon::now();
|
||||
}
|
||||
if (! is_object($date)) {
|
||||
if (!is_object($date)) {
|
||||
$date = carbon($date);
|
||||
}
|
||||
|
||||
if (! $format || ! $tz) {
|
||||
if (!$format || !$tz) {
|
||||
$system = App\Model\helpdesk\Settings\System::select('time_zone', 'date_time_format')->first();
|
||||
}
|
||||
if (! $format) {
|
||||
if (!$format) {
|
||||
$format = is_numeric($system->date_time_format) ? DB::table('date_time_format')->where('id', $system->date_time_format)->value('format') : $system->date_time_format;
|
||||
}
|
||||
if (! $tz) {
|
||||
if (!$tz) {
|
||||
$tz = is_numeric($system->time_zone) ? DB::table('timezone')->where('id', $system->time_zone)->value('name') : $system->time_zone;
|
||||
}
|
||||
|
||||
@@ -227,7 +229,8 @@ function timezone()
|
||||
* formats the error message into json error response.
|
||||
*
|
||||
* @param string/array $errorMsg errorMsg can be an array of errors or string
|
||||
* @param int $responseCode
|
||||
* @param int $responseCode
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
function errorResponse($errorMsg, $responseCode = 400)
|
||||
@@ -240,14 +243,15 @@ function errorResponse($errorMsg, $responseCode = 400)
|
||||
/**
|
||||
* formats success message/data into json success response.
|
||||
*
|
||||
* @param string $successMsg
|
||||
* @param string $successMsg
|
||||
* @param array/string $data data of the response
|
||||
* @param int $responseCode
|
||||
* @param int $responseCode
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
function successResponse($successMsg = '', $data = '', $responseCode = 200)
|
||||
{
|
||||
$response = ! $successMsg ? ['success' => true, 'data' => $data] : (! $data ? ['success' => true, 'message' => $successMsg] : ['success' => true, 'message' => $successMsg, 'data' => $data]);
|
||||
$response = !$successMsg ? ['success' => true, 'data' => $data] : (!$data ? ['success' => true, 'message' => $successMsg] : ['success' => true, 'message' => $successMsg, 'data' => $data]);
|
||||
|
||||
return response()->json($response);
|
||||
}
|
||||
@@ -255,22 +259,24 @@ function successResponse($successMsg = '', $data = '', $responseCode = 200)
|
||||
/**
|
||||
* formats exception response by giving enough information for debugginh.
|
||||
*
|
||||
* @param \Exception $exception exception object
|
||||
* @param \Exception $exception exception object
|
||||
*
|
||||
* @return Response with json response content
|
||||
*/
|
||||
function exceptionResponse(Exception $exception)
|
||||
{
|
||||
return errorResponse([
|
||||
'file' => $exception->getFile(),
|
||||
'file' => $exception->getFile(),
|
||||
'line_number' => $exception->getLine(),
|
||||
'exception' => $exception->getMessage(),
|
||||
'exception' => $exception->getMessage(),
|
||||
], 500);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an empty DB with given name.
|
||||
*
|
||||
* @param string $dbName name of the DB
|
||||
* @param string $dbName name of the DB
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
function createDB(string $dbName)
|
||||
@@ -289,7 +295,8 @@ function createDB(string $dbName)
|
||||
/**
|
||||
* parse the carbon.
|
||||
*
|
||||
* @param string $date
|
||||
* @param string $date
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
*/
|
||||
function carbon($date)
|
||||
|
Reference in New Issue
Block a user