Scalr\Stats\CostAnalytics\Iterator\ChartMonthlyIterator::current PHP Method

current() public method

See also: Iterator::current()
public current ( ) : Scalr\Stats\CostAnalytics\ChartPointInfo
return Scalr\Stats\CostAnalytics\ChartPointInfo
    public function current()
    {
        if (!isset($this->c[$this->i])) {
            $chartPoint = new ChartPointInfo($this);
            $previousPeriodDt = clone $chartPoint->dt;
            $previousPeriodDt->sub($this->getPreviousPeriodInterval());
            $chartPoint->label = $chartPoint->dt->format('M j');
            $chartPoint->key = $chartPoint->dt->format('Y-m-d');
            $chartPoint->previousPeriodKey = $previousPeriodDt->format('Y-m-d');
            $chartPoint->show = $chartPoint->i % 4 == 0 || $chartPoint->isLastPoint && $chartPoint->i % 4 > 2 ? $chartPoint->dt->format('M j') : '';
            $this->c[$this->i] = $chartPoint;
        }
        return $this->c[$this->i];
    }
ChartMonthlyIterator