@param Holiday $holiday
@param string  $state

@return bool
507909
protected function hasState(Holiday $holiday, $state = null)
    {
        if ($state === null) {
            return true;
        }

        $states = $holiday->getStates();
        if (empty($states)) {
            return true;
        }

        if (is_array($states) && in_array($state, $states)) {
            return true;
        }

        return false;
    }
1320994
public function processPolicies(ValidatorState $state, Certificate $cert): ValidatorState
    {
        $policies = $cert->tbsCertificate()
            ->extensions()
            ->certificatePolicies();
        $tree = clone $this;
        // (d.1) for each policy P not equal to anyPolicy
        foreach ($policies as $policy) {
            if ($policy->isAnyPolicy()) {
                $tree->_processAnyPolicy($policy, $cert, $state);
            } else {
                $tree->_processPolicy($policy, $state);
            }
        }
        // if whole tree is pruned
        if (!$tree->_pruneTree($state->index() - 1)) {
            return $state->withoutValidPolicyTree();
        }
        return $state->withValidPolicyTree($tree);
    }
1059743
public function execute(State $state) {
        $errors = [];
        foreach ($state->functionLookup as $name => $functions) {
            $calls = $state->callFinder->getCallsForFunction($name);
            foreach ($functions as $func) {
                foreach ($calls as $call) {
                    $errors = array_merge($errors, $this->verifyCall($func, $call[0], $state, $name));
                }
            }
        }
        foreach ($state->internalTypeInfo->functions as $name => $arginfo) {
            $calls = $state->callFinder->getCallsForFunction($name);
            foreach ($calls as $call) {
                $errors = array_merge($errors, $this->verifyInternalCall($arginfo, $call[0], $state, $name));
            }
        }
        foreach ($state->methodCalls as $call) {
            if (!$call->name instanceof Operand\Literal) {
                // Variable method call
                continue;
            }
            if (!$call->var->type || $call->var->type->type !== Type::TYPE_OBJECT) {
                // We don't know the type
                continue;
            }
            $name = strtolower($call->var->type->userType);
            if (!isset($state->classResolves[$name])) {
                // Could not find class
                continue;
            }
            foreach ($state->classResolves[$name] as $cn => $class) {
                // For every possible class that can resolve the type
                $method = $this->findMethod($class, $name);
                if (!$method) {
                    // Class does not *directly* implement method
                    continue;
                }
                $errors = array_merge($errors, $this->verifyCall($method, $call, $state, $cn . "->" . $name));
            }
        }
        return $errors;
    }
18406
private static function _debug($state=null)
	{
		static $_ = true;

		// set
		//
		if (isset($state))
		{
			$_ = (boolean) $state;
		}

		// get
		//
		return $_;
	}
754730
public function getHolidayListInICalendarFormat(HolidayList $holidayList, TranslatorInterface $translator = null, DateHelper $dateHelper = null)
    {
        $calendarFormatter = new ICalendarFormatter($translator, $dateHelper);
        $content = [];
        $content[] = $calendarFormatter->getHeader();
        $content = array_merge($content, $calendarFormatter->formatList($holidayList));
        $content[] = $calendarFormatter->getFooter();

        return implode(ICalendarFormatter::LINE_ENDING, $content).ICalendarFormatter::LINE_ENDING;
    }
911946
protected function stateHasAfterCallback($state)
    {
        return isset($this->afterMaking[$this->class][$state]) ||
               isset($this->afterCreating[$this->class][$state]);
    }
794040
public function setState($state)
    {
        $oldState = $this->getState()->getUri();
        if ($oldState == $state) {
            common_Logger::w('Delivery execution ' . $this->getIdentifier() . ' already in state ' . $state);
            return false;
        }
        $this->setData(OntologyDeliveryExecution::PROPERTY_STATUS, $state);
        if ($state == DeliveryExecutionInterface::STATE_FINISHED) {
            $this->setData(OntologyDeliveryExecution::PROPERTY_TIME_END, microtime());
        }
        return $this->service->updateDeliveryExecutionStatus($this, $oldState, $state);
    }
719160
@Override
    public final HolidayCalendar<E> setHolidays(final Set<E> holidays) {

        if (holidays == null) {
            this.holidays = Collections.emptyMap();
            return this;
        }

        final Map<String, E> newSet = new TreeMap<>();
        for (final E e : holidays) {
            newSet.put(toString(e), e);
        }
        this.holidays = Collections.unmodifiableMap(newSet);
        return this;
    }
628174
def _holiday_entry(self):
        """"""
        holidays_list = self.get_holidays_for_year()
        holidays_list = [
            holiday for holiday, holiday_hdate in holidays_list if
            holiday_hdate.hdate == self.hdate
        ]
        assert len(holidays_list) <= 1

        # If anything is left return it, otherwise return the "NULL" holiday
        return holidays_list[0] if holidays_list else htables.HOLIDAYS[0]
605801
def is_holiday(now=None, holidays="/etc/acct/holidays"):
    """"""
    now = _Time(now)
    # Now, parse holiday file.
    if not os.path.exists(holidays):
        raise Exception("There is no holidays file: %s" % holidays)

    f = open(holidays, "r")
    # First, read all leading comments.
    line = f.readline()
    while line[0] == '*': line = f.readline()

    # We just got the year line.
    (year, primestart, primeend) = str.split(line)
    # If not the right year, we have no idea for certain.  Skip.
    if not year == now.year: return 0

    # Now the dates.  Check each against now.
    while line != '':
        # Of course, ignore comments.
        if line[0] == '*':
            line = f.readline()
            continue

        try:
            # Format: "1/1	New Years Day"
            (month, day) = str.split(str.split(line)[0], "/")
            # The _Time class has leading-zero padded day numbers.
            if len(day) == 1: day = '0' + day
            # Get month number from index map (compensate for zero indexing).
            month = MONTH_MAP[int(month) - 1]

            # Check the date.
            #print month, now.month, day, now.day
            if month == now.month and day == now.day:
                return 1

            line = f.readline()
        except:
            # Skip malformed lines.
            line = f.readline()
            continue

    # If no match found, we must not be in a holiday.
    return 0
78468
private function getNoWorkDaysWithinSingleYear(DateTime $firstDay, DateTime $lastDay, string $region, int $year, array $noWork): HolidayList
    {
        $holidays = [];
        $holidays[] = $this->holidayCalculator->calculateHolidaysForYear($year, $region, $firstDay->getTimezone());
        $temporaryHolidayCalculator = new HolidayCalculator(new WeekdayInitializer());
        foreach ($noWork as $noWorkDays) {
            $holidays[] = $temporaryHolidayCalculator->calculateHolidaysForYear($year, $noWorkDays->getId(), $firstDay->getTimezone());
        }

        $holidayList = $this->mergeHolidayLists($holidays);
        $holidayList = (
        new IncludeTimespanFilter(new IncludeUniqueDateFilter(new IncludeTypeFilter())))
            ->filter($holidayList, [
                IncludeTimespanFilter::PARAM_FIRST_DAY => $firstDay,
                IncludeTimespanFilter::PARAM_LAST_DAY => $lastDay,
                IncludeTypeFilter::PARAM_HOLIDAY_TYPE => HolidayType::DAY_OFF,
            ]);

        return $holidayList;
    }
469151
public function setOverwrite($state = false)
	{
		$tmp = $this->overwrite;

		if ($state)
		{
			$this->overwrite = true;
		}
		else
		{
			$this->overwrite = false;
		}

		return $tmp;
	}
214189
public function set_state($state) {
        if ($state <= $this->state) {
            return false;
        }
        $this->state = $state;
        return true;
    }
790288
public function setLock(PackageInterface $package, $state)
    {
        if ((bool) $state) {
            return $this->lockPackage($package);
        }

        return $this->unlockPackage($package);
    }
346402
public function isLanguageIncludedInRoutes($state = null)
    {
        if (isset($state)) {
            $this->languageIncludedInRoutes = (bool) $state;
        }

        return $this->languageIncludedInRoutes;
    }
290670
public function execute(State $state) {
        $errors = [];
        foreach ($state->functions as $function) {
            $errors = array_merge($errors, $this->verifyReturn($function, $state));
        }
        foreach ($state->methods as $method) {
            $errors = array_merge($errors, $this->verifyReturn($method, $state));
        }
        return $errors;
    }
585527
protected function setState($state)
    {
        $serviceService = $this->getServiceLocator()->get(StateStorage::SERVICE_ID);
        $userUri = $this->getSession()->getUserUri();
        return is_null($userUri) ? false : $serviceService->set($userUri, $this->getServiceCallId(), $state);
    }