@param DateTimeParseResult $result

@return YearMonth

@throws DateTimeException      If the year-month is not valid.
@throws DateTimeParseException If required fields are missing from the result.
323367
public static function from(DateTimeParseResult $result) : YearMonth
    {
        return YearMonth::of(
            (int) $result->getField(Field\Year::NAME),
            (int) $result->getField(Field\MonthOfYear::NAME)
        );
    }
862424
public static function buildMessage(ResultException $result)
    {
        $translateKey = self::TRANSLATE_KEY_PREFIX . $result->globalCode;
        $message = self::translate($translateKey);

        return empty($message) ? $result->getAlias() : $message;
    }
1096318
public function sum($result, $field = 1)
    {
        $field = $this->prepareField($field);

        $this->fields[$result] = ['$sum' => $field];

        return $this;
    }
205362
public function getTimeOnSite($parameters = [], $parseResult = true)
    {
        $this->setParams([
            'metrics'    => 'ga:sessions',
            'dimensions' => 'ga:operatingSystem,ga:operatingSystemVersion,ga:browser,ga:browserVersion',
        ]);

        return $this->execute($parameters, $parseResult);
    }
37852
protected function parseResult($result) {
 
        if (! property_exists($result, 'return')) {
            return [];
        }

        $result = $result->return;
        
        if (is_null($result)) {
            return [];
        }
        
        if (!is_array($result)) {
            $result = [$result];
        }

        return $this->filterResult($result);
    }
346554
public function byMonths(int $months): Date
    {
        return $this->monthTo($this->originalDate->month() + $months);
    }
580389
private static function parsePercent($input, &$result)
    {
        // Detect and remove percent sign
        if (preg_match('/^\\s*(\\d*(?:\\.\\d*)?)%\\s*$/', $input, $matches)) {
            $result = floatval($matches[1]) / 100;
            
            if ($result < 0) $result = 0;
            if ($result > 1) $result = 1;
            
            return true;
        }
        return false;
    }
155487
@Override
    public boolean include(T result) {
        return getDateRange().inRange(DateUtil.stripTime(dateTypeExtractor.getDateByType(result, dateType)), true, true);
    }
969944
private function fixMonth(DateTime $result)
	{
		if ($result->format('d') != $this->format('d'))
		{
			$result = $result->subMonths(1);
			$result->datetime->setDate($result->format('Y'), $result->format('m'), $result->format('t'));
		}

		return $result;
	}
358349
public function setResult(&$result) {
        if (!is_null($result) &&
            !$result instanceof Garp_Db_Table_Row &&
            !$result instanceof Garp_Db_Table_Rowset) {
                throw new InvalidArgumentException(__METHOD__.' expects parameter 1 to be a'.
                    'Garp_Db_Table_Row or Garp_Db_Table_Rowset. '.gettype($result).' given.');
        }
        $this->_result = $result;
    }
1134187
private function format(DiffResult $result)
    {
        $serializer = SerializerBuilder::create()->build();

        return $serializer->serialize($result, 'json');
    }
1195173
public function daysInMonth($year, $month)
    {
        if ($year <= 0) {
            throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
        } elseif ($month < 1 || $month > 13) {
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
        } elseif ($month !== 13) {
            return 30;
        } elseif ($this->isLeapYear($year)) {
            return 6;
        } else {
            return 5;
        }
    }
407984
private function _addResultSuffix(\DateInterval $interval, $result)
    {
        return $interval->invert ? self::$PREFIX_IN."\xC2\xA0".$result : $result."\xC2\xA0".self::$SUFFIX_AGO;
    }
114188
public function getSecond($yearOrStart, $month = null, $day = null, $hour = null, $minute = null, $second = null)
    {
        if (!$yearOrStart instanceof \DateTime) {
            $yearOrStart = new \DateTime(
                sprintf('%s-%s-%s %s:%s:%s', $yearOrStart, $month, $day, $hour, $minute, $second)
            );
        }

        return $this->getFactory()->createSecond($yearOrStart);
    }
42996
public static YearMonth parse(String str, DateTimeFormatter formatter) {
        LocalDate date = formatter.parseLocalDate(str);
        return new YearMonth(date.getYear(), date.getMonthOfYear());
    }
1297946
public static function from(DateTimeParseResult $result) : LocalDate
    {
        $year  = (int) $result->getField(Field\Year::NAME);
        $month = (int) $result->getField(Field\MonthOfYear::NAME);
        $day   = (int) $result->getField(Field\DayOfMonth::NAME);

        return LocalDate::of($year, $month, $day);
    }
1108520
private function addCurrencySymbol($result)
    {
        $format = ($this->config['symbol_position'] === 'left')
            ? '%1$s %2$s'
            : '%2$s %1$s';

        return sprintf(
            $format,
            $this->context->getCurrencySymbol($this->config),
            $result
        );
    }