Gets the crawler for the web page according to the configuration file
@param int $year
@return boolean|\Symfony\Component\DomCrawler\Crawler
544009
protected function getCrawler(int $year)
	{
		$getter = 'getters.uf.' . $this->getter;
		$url = str_replace('<year>', $year, config($getter . '.part'));
		try {
			$request = $this->client->request('GET', $url);
		} catch (ClientException $e) {
			return false;
		}

		if ($request->getStatusCode() != 200) {
			return false;
		}
		$client = new GClient();
		$uri = config($getter . '.url') . $url;
		$crawler = $client->request('GET', $uri);
		return $crawler;
	}
666358
protected function matches($crawler): bool
    {
        $pattern = $this->getEscapedPattern($this->source);

        return preg_match("/{$pattern}/i", $this->html($crawler));
    }
1173785
private function createSubCrawler($nodes)
    {
        $crawler = new static($nodes, $this->uri, $this->baseHref);
        $crawler->isHtml = $this->isHtml;
        $crawler->document = $this->document;
        $crawler->namespaces = $this->namespaces;
        $crawler->html5Parser = $this->html5Parser;

        return $crawler;
    }
751556
public static function getFullYear($year)
    {
        is_string($year) && ($year = (int)$year);
        if ($year < 100) {
            $yr = (int)date("Y");
            $century = (int)($yr / 100);
            if ($yr % 100 > 50) {
                $c1 = $century + 1;
                $c0 = $century;
            } else {
                $c1 = $century;
                $c0 = $century - 1;
            }
            $c1 *= 100;
            // if 2-digit year is less than 30 years in future, set it to this century
            // otherwise if more than 30 years in future, then we set 2-digit year to the prev century.
            if (($year + $c1) < $yr + 30) {
                $year = $year + $c1;
            } else {
                $year = $year + $c0 * 100;
            }
        }
        return $year;
    }
476981
protected function _crawlUrl($url) {
        $client = Mage::helper('turpentine/cron')->getCrawlerClient();
        $client->setUri($url);
        Mage::helper('turpentine/debug')->logDebug('Crawling URL: %s', $url);
        try {
            $response = $client->request();
        } catch (Exception $e) {
            Mage::helper('turpentine/debug')->logWarn(
                'Error crawling URL (%s): %s',
                $url, $e->getMessage() );
            return false;
        }
        return $response->isSuccessful();
    }
1273534
protected function getCrawler(Response $response)
    {
        if ($this->crawler) {
            return $this->crawler;
        }

        return $this->crawler = new Crawler($response->getContent());
    }
370361
public function getCrawler()
    {
        if (null === $this->crawler) {
            @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED);
            // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
        }

        return $this->crawler;
    }
1129124
public static function cWeeks($year = null) {
		if ($year === null) {
			$year = date('Y');
		}
		return (int)date('W', mktime(23, 59, 59, 12, 28, $year));
	}
1149128
public function getHolidaysByYear($year)
    {
        $easter = $this->getEasterDates($year);

        $mothersDay = date('m-d', strtotime('second Sunday of May '. $year));

        $holidays = array(
            '01-01' => $this->createData('Jaunais Gads'),
            '05-01' => $this->createData('Darba svētki'),
            '05-04' => $this->createData('Latvijas Republikas Neatkarības atjaunošanas diena'),
            $mothersDay => $this->createData('Mātes diena'),
            '06-23' => $this->createData('Līgo Diena'),
            '06-24' => $this->createData('Jāņi'),
            '11-18' => $this->createData('Latvijas Republikas proklamēšanas diena'),
            '12-24' => $this->createData('Ziemassvētku vakars'),
            '12-25' => $this->createData('Ziemassvētki'),
            '12-26' => $this->createData('Otrie Ziemassvētki'),
            '12-31' => $this->createData('Vecgada vakars'),

            // Easter dates
            $easter['goodFriday']->format(self::DATE_FORMAT) => $this->createData('Lielā Piektdiena'),
            $easter['easterSunday']->format(self::DATE_FORMAT) => $this->createData('Lieldienas'),
            $easter['easterMonday']->format(self::DATE_FORMAT) => $this->createData('Otrās Lieldienas'),
        );

        return $holidays;
    }
1117402
public function setYear($year)
    {
        if (!is_scalar($year)) {
            throw new Exception('Year must be a string or an integer in EventManager setYear method.');
        }
        $this->year = $year;

        return $this->year;
    }
644723
public function getSelectedValue(Crawler $crawler)
    {
        $field = $this->field($crawler);

        return $field->nodeName() == 'select'
            ? $this->getSelectedValueFromSelect($field)
            : [$this->getCheckedValueFromRadioGroup($field)];
    }
578416
public function year($options = array())
    {
        $options = new AnConfig($options);
        $date = new AnDate(new AnConfig());
        $year = $date->year;

        $options->append(array(
            'start' => $year,
            'end' => $year + 10,
            'selected' => null,
            'prompt' => true,
        ));

        $selected = $options->selected;
        unset($options->selected);
        $prompt = $options->prompt;
        unset($options->prompt);
        $years = array_combine(range($options->start, $options->end), range($options->start, $options->end));

        if ($prompt) {
            $array = array(AnTranslator::_('LIB-AN-SELECTOR-SELECT-YEAR'));
            $years = AnHelperArray::merge($array, $years);
        }

        return $this->_html->select($options->name, array('options' => $years, 'selected' => $selected), AnConfig::unbox($options));
    }
554540
protected function getYears()
    {
        $intSecondsPerYear = ($this->isPositive()) ? DateTimeSpan::SECONDS_PER_YEAR : ((-1) * DateTimeSpan::SECONDS_PER_YEAR);
        $intYears = floor($this->intSeconds / $intSecondsPerYear);
        if ($this->isNegative()) {
            $intYears = (-1) * $intYears;
        }
        return $intYears;
    }
1159437
public function get(int $year)
    {
        // convert the Ethiopian year to a Julian year
        // ሚያዝያ 1 is just a random day after the Gregorian new year
        $julian_year = (int) DateTimeFactory::of($year, 8, 1)
            ->toGregorian()->format('Y');

        // get the number of days from vernal equinox to the Easter in the given Julian year
        $days_after = easter_days($julian_year, CAL_EASTER_ALWAYS_JULIAN);

        // get the JDN of vernal equinox (March 21) in the given Julian year
        $jdn = juliantojd(3, 21, $julian_year);

        // add the number of days to Easter
        $jdn += $days_after;

        // create a Ethiopian Date to JDN converter
        $con = new FromJdnConverter($jdn);

        // create an Ethiopian date from the converter
        return DateTimeFactory::of($con->getYear(), $con->getMonth(), $con->getDay(),
            0, 0, 0, $this->dateTimeZone);
    }
647079
public function getHolidaysByYear($year)
    {
        $easter = $this->getEasterDates($year);

        return array(
            '01-01' => $this->createData('1. nyttårsdag'),
            '05-01' => $this->createData('1. mai'),
            '05-17' => $this->createData('Grunnlovsdagen'),
            '12-25' => $this->createData('1. juledag'),
            '12-26' => $this->createData('2. juledag'),
            // Variable dates
			$easter['maundyThursday']->format(self::DATE_FORMAT)  => $this->createData('Skjærtorsdag'),
            $easter['goodFriday']->format(self::DATE_FORMAT)      => $this->createData('Langfredag'),
            $easter['easterSunday']->format(self::DATE_FORMAT)    => $this->createData('1. påskedag'),
            $easter['easterMonday']->format(self::DATE_FORMAT)    => $this->createData('2. påskedag'),
            $easter['ascensionDay']->format(self::DATE_FORMAT)    => $this->createData('Kristi Himmelfartsdag'),
            $easter['pentecostMonday']->format(self::DATE_FORMAT) => $this->createData('2. pinsedag'),
		);
    }
1351803
public function archiveYearlyAction($year, Request $request = null)
    {
        $action = $this->container->get(YearlyPostArchiveAction::class);

        return $action($this->resolveRequest($request), $year);
    }
806100
public function get($selector)
    {
        $xpath = new \DOMXPath($this->dom);

        if (class_exists('Symfony\Component\CssSelector\CssSelector')) {
            $expression = CssSelector::toXPath($selector);
        } else {
            $converter  = new CssSelectorConverter();
            $expression = $converter->toXPath($selector);
        }
        $nodes = $xpath->query($expression);

        $glnodes = [];
        foreach ($nodes as $node) {
            $glnodes[] = new GlHtmlNode($node);
        }

        return $glnodes;
    }