Skip to content

Commit

Permalink
coding standard
Browse files Browse the repository at this point in the history
Used: validators

Fixing bug

Removed: shipping in Calendar

Fixed: namespace conflict
  • Loading branch information
JanGalek committed Apr 13, 2018
1 parent 4743ff5 commit c9311a5
Show file tree
Hide file tree
Showing 33 changed files with 493 additions and 1,260 deletions.
4 changes: 2 additions & 2 deletions src/Galek/Utils/Calendar/Business/IShipper.php
Expand Up @@ -4,7 +4,7 @@
* User: Galek
* Date: 4.4.2018
*/
declare(strict_types=1);
declare(strict_types = 1);

namespace Galek\Utils\Calendar\Business;

Expand All @@ -14,7 +14,7 @@

interface IShipper
{
public function getName(): string ;
public function getName(): string;

public function getCurrentDate(): Calendar;

Expand Down
14 changes: 7 additions & 7 deletions src/Galek/Utils/Calendar/Business/Shipper.php
Expand Up @@ -4,7 +4,7 @@
* User: Galek
* Date: 9.3.2018
*/
declare(strict_types=1);
declare(strict_types = 1);

namespace Galek\Utils\Calendar\Business;

Expand Down Expand Up @@ -57,7 +57,7 @@ class Shipper implements IShipper
public function __construct(string $name, Localization $configuration, int $hour, int $minute, bool $weekend = false, int $deliveryTime = 1)
{
$this->setTime($hour, $minute);
$this->enableWeekend($weekend);
$this->weekend = $weekend;
$this->configuration = $configuration;
$this->deliveryTime = $deliveryTime;
$this->name = $name;
Expand Down Expand Up @@ -97,18 +97,18 @@ public function getDate(): Calendar
}

if ($this->weekend === false) {
$date = $date->getWorkDay();
$date = Day::getWorkDay($date, $date->getHolidays());
}
} else {
if ($this->weekend === false) {
$date = $date->getWorkDay();
$date = Day::getWorkDay($date, $date->getHolidays());
}
}

$date->modify('+' . $this->deliveryTime . ' days');

if ($this->weekend === false) {
$date = $date->getWorkDay();
$date = Day::getWorkDay($date, $date->getHolidays());
}

//return $date->getWorkDay();
Expand All @@ -119,12 +119,12 @@ public function getDate(): Calendar
public function getDeliveryTextDate(string $format = 'Y.m.d'): string
{
$date = $this->getDate();
$dayNumber = $date->dayNumber();
$dayNumber = Day::getNumber($date);
$local = $this->configuration->getLocalization();
$at = $local->getAt($dayNumber);
$day = $local->getInflexion($dayNumber, 4);

return $at . ' ' . $day . ' ' .$date->format($format);
return $at . ' ' . $day . ' ' . $date->format($format);
}


Expand Down
6 changes: 3 additions & 3 deletions src/Galek/Utils/Calendar/Business/Work.php
Expand Up @@ -4,7 +4,7 @@
* User: Jan Galek
* Date: 10.03.2018
*/
declare(strict_types=1);
declare(strict_types = 1);

namespace Galek\Utils\Calendar\Business;

Expand All @@ -29,8 +29,8 @@ public function __construct(Localization $localization, array $settings)
{
$startHour = $settings['start']['hour'];
$startMinute = $settings['start']['minute'];
$endHour = $settings['start']['hour'];
$endMinute = $settings['start']['minute'];
$endHour = $settings['end']['hour'];
$endMinute = $settings['end']['minute'];
HourValidator::validate($startHour);
MinuteValidator::validate($startMinute);
HourValidator::validate($endHour);
Expand Down

0 comments on commit c9311a5

Please sign in to comment.