gregoryv/timesheet-file-format

View on GitHub
bin/sum-timesheet

Summary

Maintainability
Test Coverage
#!/usr/bin/env php
<?php
require __DIR__ . '/../vendor/autoload.php';
use gregoryv\timesheet\Sheet;
use gregoryv\timesheet\Totals;

/**
  *  Prints out summary of one or more timesheet files.
  */
$totals = new Totals();
foreach ($argv as $path) {
  $txt = file_get_contents($path);
  $sheet = new Sheet($txt);
  foreach ($sheet->readTimeTags() as $time) {
    $totals->add($time);
  }
}

print $totals->toLine();