Skip to content

Commit

Permalink
Merge pull request #2 from bdumitrua/1.x
Browse files Browse the repository at this point in the history
Добавление данных о количестве сокращённых рабочих дней в статистику
  • Loading branch information
shahruslan authored Nov 14, 2024
2 parents 17de0d6 + a5a5be1 commit 5106da9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ $calendarForDay = $calendar->getPeriodForDay(new DateTime('2024-01-01'));
- `workDays` – количество рабочих дней в периоде;
- `weekends` – количество выходных дней в периоде (без учета праздничных);
- `holidays` – количество праздничных дней в периоде;
- `shortenedWorkingDays` – количество сокращённых рабочих дней в периоде;
- `workingHours` – количество рабочего времени за период.

```php
use Shahruslan\ProductionCalendar\Calendar;

$calendar = new Calendar('your-token');
$period = $calendar->getPeriod('08.01.2024-10.01.2024', region: 23);
$period = $calendar->getPeriod('07.01.2024-09.01.2024', region: 23);
print_r($period);
```
Output:
Expand Down Expand Up @@ -165,6 +166,7 @@ Shahruslan\ProductionCalendar\Entity\Period Object
[workDays] => 1
[weekends] => 0
[holidays] => 2
[shortenedWorkingDays] => 0
[workingHours] => 8
)
)
Expand Down
1 change: 1 addition & 0 deletions src/Entity/Statistic.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function __construct(
public readonly int $workDays,
public readonly int $weekends,
public readonly int $holidays,
public readonly int $shortenedWorkingDays,
public readonly int $workingHours,
) {}
}
1 change: 1 addition & 0 deletions src/Factory/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public static function createPeriod(object $data): Period
$data->statistic->work_days,
$data->statistic->weekends,
$data->statistic->holidays,
$data->statistic->shortened_working_days,
$data->statistic->working_hours,
);

Expand Down

0 comments on commit 5106da9

Please sign in to comment.