Skip to content

Commit

Permalink
Merge pull request #7 from pratiksh404/analysis-WNvLle
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
pratiksh404 authored Sep 15, 2021
2 parents d452808 + b436ae8 commit 6cce5df
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
13 changes: 7 additions & 6 deletions src/Helpers/NepaliDateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Carbon\Carbon;
use Pratiksh\Nepalidate\Services\NepaliDate;

if (!function_exists('nepaliDate')) {
if (! function_exists('nepaliDate')) {
function nepaliDate(Carbon $date)
{
$mode = config('nepalidate.mode', 1);
Expand All @@ -19,39 +19,40 @@ function nepaliDate(Carbon $date)
}
}

if (!function_exists('toBS')) {
if (! function_exists('toBS')) {
function toBS(Carbon $date)
{
return (new NepaliDate())->create($date)->toBS();
}
}

if (!function_exists('toFormattedBSDate')) {
if (! function_exists('toFormattedBSDate')) {
function toFormattedBSDate(Carbon $date)
{
return (new NepaliDate())->create($date)->toFormattedBSDate();
}
}

if (!function_exists('toFormattedNepaliDate')) {
if (! function_exists('toFormattedNepaliDate')) {
function toFormattedNepaliDate(Carbon $date)
{
return (new NepaliDate())->create($date)->toFormattedNepaliDate();
}
}

if (!function_exists('toDetailBS')) {
if (! function_exists('toDetailBS')) {
function toDetailBS(Carbon $date)
{
$bs_array = (new NepaliDate())->create($date)->toBSArray();
$to_detail_bs = null;
if (!is_null($bs_array)) {
if (! is_null($bs_array)) {
if (is_array($bs_array)) {
if (count($bs_array) > 0) {
$to_detail_bs = json_decode(json_encode($bs_array));
}
}
}

return $to_detail_bs;
}
}
21 changes: 11 additions & 10 deletions src/Services/NepaliDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,24 +190,24 @@ public function create(Carbon $date)

public function toBS()
{
return $this->nepaliYear . '-' . $this->nepaliMonth . '-' . $this->nepaliDay;
return $this->nepaliYear.'-'.$this->nepaliMonth.'-'.$this->nepaliDay;
}

public function toFormattedBSDate()
{
return $this->nepaliDay . ' ' .
$this->formattedBSMonth($this->nepaliMonth) . ' ' .
$this->nepaliYear . ',' .
' ' .
return $this->nepaliDay.' '.
$this->formattedBSMonth($this->nepaliMonth).' '.
$this->nepaliYear.','.
' '.
$this->formattedBSDateOfWeek($this->dayOfWeek);
}

public function toFormattedNepaliDate()
{
return $this->formattedNepaliNumber($this->nepaliDay) . ' ' .
$this->formattedNepaliMonth($this->nepaliMonth) . ' ' .
$this->formattedNepaliNumber($this->nepaliYear) . ',' .
' ' .
return $this->formattedNepaliNumber($this->nepaliDay).' '.
$this->formattedNepaliMonth($this->nepaliMonth).' '.
$this->formattedNepaliNumber($this->nepaliYear).','.
' '.
$this->formattedNepaliDateOfWeek($this->dayOfWeek);
}

Expand All @@ -225,13 +225,14 @@ public function toDetailBS()
{
$bs_array = $this->toBSArray();
$to_detail_bs = null;
if (!is_null($bs_array)) {
if (! is_null($bs_array)) {
if (is_array($bs_array)) {
if (count($bs_array) > 0) {
$to_detail_bs = json_decode(json_encode($bs_array));
}
}
}

return $to_detail_bs;
}

Expand Down

0 comments on commit 6cce5df

Please sign in to comment.