@param $yearOrStart

@return Period\Year
969563
public function getYear($yearOrStart)
    {
        if (!$yearOrStart instanceof \DateTime) {
            $yearOrStart = new \DateTime(sprintf('%s-01-01', $yearOrStart));
        }

        return $this->getFactory()->createYear($yearOrStart);
    }
656966
public static function userAgentStart($userAgent)
    {

        $mobile_ua = strtolower(substr($userAgent, 0, 4));

        return (in_array($mobile_ua, self::$_uaBegin));
    }
1313610
public function getDateFormat($includeYear = TRUE, $includeDate = TRUE) {
        $returnVar = $this->getCurrentFormat();
        if(!$includeYear) {
            if(preg_match('@^Y@', $returnVar)) {
                $returnVar = substr($returnVar, 2); //If it starts with the year
            } elseif(preg_match('@Y$@', $returnVar)) {
                $returnVar = substr($returnVar, 0, -2); //If ends with the year
            } else {
                $returnVar = preg_replace('@Y.@', '', $returnVar); //If in middle if year
            }
        }
        if(!$includeDate) {
            if(preg_match('@^d@', $returnVar)) {
                $returnVar = substr($returnVar, 2); //If it starts with the year
            } elseif(preg_match('@d$@', $returnVar)) {
                $returnVar = substr($returnVar, 0, -2); //If ends with the year
            } else {
                $returnVar = preg_replace('@d.@', '', $returnVar); //If in middle if year
            }
        }
        return $returnVar;
    }
1250470
public function year()
    {
        if (!isset($this->year)) {
            $this->year = new Year($this->startDateTime->format('Y'));
        }
        return $this->year;
    }
330383
public function startOfCentury()
    {
        $year = $this->startOfYear()->year(($this->year - 1) - ($this->year - 1) % ChronosInterface::YEARS_PER_CENTURY + 1)->year;

        return $this->modify("first day of january $year, midnight");
    }
465042
public static function yearly($object, $objectId)
    {
        $statArray = [];
        foreach (self::getRows($object, $objectId, true, null, null, null) as $stat) {
            $statArray[$stat->year] = $stat->count;
        }
        return $statArray;
    }
182927
public function createStart($name, $attr = array())
    {
        $p = clone $this->p_start;
        $p->__construct($name, $attr);
        return $p;
    }
69608
public function getHour($yearOrStart, $month = null, $day = null, $hour = null)
    {
        if (!$yearOrStart instanceof \DateTime) {
            $yearOrStart = new \DateTime(sprintf('%s-%s-%s %s:00', $yearOrStart, $month, $day, $hour));
        }

        return $this->getFactory()->createHour($yearOrStart);
    }
66986
public function mark_inprogress($timestarted = null) {

        $timenow = time();

        // Set reaggregate flag
        $this->reaggregate = $timenow;

        if (!$this->timestarted) {

            if (!$timestarted) {
                $timestarted = $timenow;
            }

            $this->timestarted = $timestarted;
        }

        return $this->_save();
    }
510223
public function getStartDate() : ?int 
    {
        if ( ! $this->hasStartDate()) {
            $this->setStartDate($this->getDefaultStartDate());
        }
        return $this->startDate;
    }
156193
public function setDateStart($start, $field = null)
    {
        $param = $this->buildParam('facet.date.start', $field);
        return $this->set($param, $start);
    }
1053599
public function plusYears(int $years) : YearMonth
    {
        if ($years === 0) {
            return $this;
        }

        return $this->withYear($this->year + $years);
    }
71675
public function getStartDate()
    {
        $topic = BaseManager::build('FelixOnline\Core\Topic', 'article_topic', 'topic')
            ->filter('topic = "%s"', array($this->getSlug()));

        $article = BaseManager::build('FelixOnline\Core\Article', 'article', 'id')
            ->join($topic, 'LEFT', 'id', 'article')
            ->filter('published > 0')
            ->order('published', 'ASC')
            ->limit(0, 1)
            ->values();

        if (!$article) {
            throw new \FelixOnline\Exceptions\InternalException('No articles posted in this topic');
        }

        return($article[0]->getPublished());
    }
189463
public static function periodDisplay($period, $year, $number, $length = 0)
    {
        $periodRange = $this->periodRange($period, $length);

        return $periodRange[$number] . ', ' . $year;
    }
769913
public function startOfCentury()
    {
        $year = $this->year - ($this->year - 1) % static::YEARS_PER_CENTURY;

        return $this->setDate($year, 1, 1)->startOfDay();
    }
183098
public static function toJapaneseYear($year, $yearType = self::YEAR_KANJI, $numeralType = null)
    {
        if ($year < self::$mapEras[0]['year']) {
            throw new Exception('The year ' . $year . ' is before any of the known Japanese eras. The first era started in ' . self::$mapEras[0]['year'] . '.');
        }
        $max = count(self::$mapEras);
        $era = self::$mapEras[$max - 1];
        for ($i = 1; $i < $max; $i++) {
            $currentEra = self::$mapEras[$i];
            $startYear = $currentEra['year'];
            if ($startYear > $year) {
                $era = self::$mapEras[$i - 1];
                break;
            }
        }
        $eraValue = $year - $era['year'] + 1;
        if ($numeralType !== null) {
            $eraValue = self::toJapaneseNumeral($eraValue, $numeralType);
        }
        switch ($yearType) {
            case self::YEAR_KANJI:
                $eraName = $era['kanji'];
                $eraValue .= '年';
                break;
            case self::YEAR_ROMAJI:
                $eraName = $era['romaji'] . ' ';
                break;
            case self::YEAR_KANA:
                $eraName = $era['kana'];
                $eraValue .= 'ねん';
                break;
            default:
                throw new Exception('Unknown year type');
        }
        return $eraName . $eraValue;
    }
651350
protected function _yearSelect($options, $context)
    {
        $options += [
            'name' => '',
            'val' => null,
            'start' => date('Y', strtotime('-5 years')),
            'end' => date('Y', strtotime('+5 years')),
            'order' => 'desc',
            'templateVars' => [],
            'options' => []
        ];

        if (!empty($options['val'])) {
            $options['start'] = min($options['val'], $options['start']);
            $options['end'] = max($options['val'], $options['end']);
        }
        if (empty($options['options'])) {
            $options['options'] = $this->_generateNumbers($options['start'], $options['end']);
        }
        if ($options['order'] === 'desc') {
            $options['options'] = array_reverse($options['options'], true);
        }
        unset($options['start'], $options['end'], $options['order']);

        return $this->_select->render($options, $context);
    }