# disk-usage-insights/1.6/src/Domain/Collect/DetermineFileSizesJob.php

Disk Usage Insights, version 1.6. 43 lines.

- Page: https://pluginprobe.com/plugins/disk-usage-insights/1.6/code/src/Domain/Collect/DetermineFileSizesJob.php
- Raw: https://pluginprobe.com/plugins/disk-usage-insights/1.6/raw/src/Domain/Collect/DetermineFileSizesJob.php
- Modified: 2025-04-08T13:02:04+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/disk-usage-insights/1.6/code/src/Domain/Collect/DetermineFileSizesJob.php#L10-L20`.

```php
<?php

namespace Mgleis\DiskUsageInsights\Domain\Collect;

use Mgleis\DiskUsageInsights\Domain\FileEntry;
use Mgleis\DiskUsageInsights\Domain\Jobs\BaseJob;

class DetermineFileSizesJob extends BaseJob {

    private int $skip;
    private int $count;
    private int $totalCount;

    public function __construct(int $skip, int $count, int $totalCount) {
        $this->skip = $skip;
        $this->count = $count;
        $this->totalCount = $totalCount;
    }

    public function work() {
        $this->log(self::class);
        $fileEntries = $this->fileEntryRepository->get($this->skip, $this->count, FileEntry::TYPE_FILE);

        $root = $this->snapshotRepository->load()->root;
        foreach ($fileEntries as $fileEntry) {

            $absoluteFilename = $this->fileEntryRepository->calcFullPath($fileEntry, $root);

            $fileEntry->size = filesize($absoluteFilename);
            $this->fileEntryRepository->createOrUpdate($fileEntry);
        }
    }

    public function toArray() {
        return ['type' => self::class, 'args' => [$this->skip, $this->count, $this->totalCount]];
    }

    public function toDescription(): string {
        return sprintf('Determining file sizes... %s%%', round(100 * $this->skip / $this->totalCount));
    }

}

```
