Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
15 / 15
AverageSpeed
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
4
100.00% covered (success)
100.00%
15 / 15
 initialize()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
6 / 6
 execute()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 finalize()
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
8 / 8
<?php
/**
 *
 */
namespace aae\geo\meta {
    /**
     * @author Axel Ancona Esselmann
     * @package aae\geo\meta
     */
    class AverageSpeed {
        public $varName = "averageSpeed";
        public $metaDataObject = null;
        public function initialize() {
            $meta           = $this->metaDataObject;
            $distancePlugin = new \aae\geo\meta\TotalDistance();
            $meta->addPlugin($distancePlugin);
            $timePlugin     = new \aae\geo\meta\TotalTime();
            $meta->addPlugin($timePlugin);
        }
        
        public function execute() {
        }
        public function finalize() {
            $meta = $this->metaDataObject;
            $var = $this->varName;
            $distance = $meta->totalDistance;
            $time = $meta->totalTime;
            if ($time > 0) {
                $meta->$var += $distance / ($time / (60 * 60));
            }
        }
    }
}