$options = []; $pFFA = new adriangibbons\phpFITFileAnalysis(__DIR__ . $file, $options); // Google Time Zone API $date = new DateTime('now', new DateTimeZone('UTC')); $date_s = $pFFA->data_mesgs['session']['start_time']; $url_tz = "https://maps.googleapis.com/maps/api/timezone/json?location=" . reset($pFFA->data_mesgs['record']['position_lat']) . ',' . reset($pFFA->data_mesgs['record']['position_long']) . "×tamp=" . $date_s . "&key=AIzaSyDlPWKTvmHsZ-X6PGsBPAvo0nm1-WdwuYE"; $result = file_get_contents("{$url_tz}"); $json_tz = json_decode($result); if ($json_tz->status == "OK") { $date_s = $date_s + $json_tz->rawOffset + $json_tz->dstOffset; } $date->setTimestamp($date_s); $ftp = 329; $hr_metrics = $pFFA->hrMetrics(52, 185, 172, 'male'); $power_metrics = $pFFA->powerMetrics($ftp); $criticalPower = $pFFA->criticalPower([2, 3, 5, 10, 30, 60, 120, 300, 600, 1200, 3600, 7200, 10800, 18000]); $power_histogram = $pFFA->powerHistogram(); $power_table = $pFFA->powerPartioned($ftp); $power_pie_chart = $pFFA->partitionData('power', $pFFA->powerZones($ftp), true, false); $quad_plot = $pFFA->quadrantAnalysis(0.175, $ftp); } catch (Exception $e) { echo 'caught exception: ' . $e->getMessage(); die; } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>phpFITFileAnalysis demo</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
/** * @expectedException Exception */ public function testPower_criticalPower_no_power() { $pFFA = new adriangibbons\phpFITFileAnalysis($this->base_dir . 'road-cycling.fit'); $time_periods = [2, 14400]; $cps = $pFFA->criticalPower($time_periods); }