/*
check ticket availability
@return bool
351278
private function getUrl($url)
	{
		$ch = curl_init();
		curl_setopt($ch,CURLOPT_URL,$url);
		curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
		curl_setopt($ch,CURLOPT_HEADER,0);
		// curl_setopt($ch, CURLOPT_ENCODING, "");
		$output = curl_exec($ch);
		curl_close($ch);
	    return $output;
	}
921596
public static function isTracTicketClosed( $trac_url, $ticket_id ) {
		if ( ! extension_loaded( 'openssl' ) ) {
			$trac_url = preg_replace( "/^https:/", "http:", $trac_url );
		}

		if ( ! isset( self::$trac_ticket_cache[ $trac_url ] ) ) {
			// In case you're running the tests offline, keep track of open tickets.
			$file = DIR_TESTDATA . '/.trac-ticket-cache.' . str_replace( array( 'http://', 'https://', '/' ), array( '', '', '-' ), rtrim( $trac_url, '/' ) );
			$tickets = @file_get_contents( $trac_url . '/query?status=%21closed&format=csv&col=id' );
			// Check if our HTTP request failed.
			if ( false === $tickets ) {
				if ( file_exists( $file ) ) {
					register_shutdown_function( array( 'TracTickets', 'usingLocalCache' ) );
					$tickets = file_get_contents( $file );
				} else {
					register_shutdown_function( array( 'TracTickets', 'forcingKnownBugs' ) );
					self::$trac_ticket_cache[ $trac_url ] = array();
					return true; // Assume the ticket is closed, which means it gets run.
				}
			} else {
				$tickets = substr( $tickets, 2 ); // remove 'id' column header
				$tickets = trim( $tickets );
				file_put_contents( $file, $tickets );
			}
			$tickets = explode( "\r\n", $tickets );
			self::$trac_ticket_cache[ $trac_url ] = $tickets;
		}

		return ! in_array( $ticket_id, self::$trac_ticket_cache[ $trac_url ] );
	}
287925
public function check()
    {
        $currentValue = (int) ini_get($this->setting);
        
        $return = false;
        foreach($this->requiredValues as $key => $requiredValue){
            $this->requiredValues[$key]['isValid'] = version_compare($currentValue, $requiredValue['requiredValue'], $requiredValue['operator']);
            
            if($this->requiredValues[$key]['isValid']){
                $return = true;
            }
        }
        
        return $return;
    }
235252
public function valid() {

		if ( empty( $this->pod_id ) ) {
			return false;
		}

		if ( $this->iterator ) {
			return isset( $this->rows[ $this->row_number ] );
		}

		return true;
	}
1036469
public function isAccessible()
    {
        $loop = $this;
        $access = true;

        while ($loop->getReply() != null) {
            $loop = $loop->getReply();

            if ($loop->getSpam() == 1 || $loop->getActive() == 0 || $loop->isEmailValid() == 0) {
                $access = false;
            }
        }

        return $access;
    }
566764
public function ticket($forceRefresh = false)
    {
        $key = self::GROUP_TICKET_CACHE_PREFIX.$this->getAccessToken()->getFingerprint();
        $ticket = $this->getCache()->fetch($key);

        if (!$forceRefresh && !empty($ticket)) {
            return $ticket;
        }

        $result = $this->parseJSON('get', [self::API_GROUP_TICKET, ['type' => 'contact']]);

        $this->getCache()->save($key, $result, $result['expires_in'] - 500);

        return $result;
    }
322151
public function ticket($forceRefresh = false)
    {
        $key = self::TICKET_CACHE_PREFIX.$this->getAccessToken()->getFingerprint();
        $ticket = $this->getCache()->fetch($key);

        if (!$forceRefresh && !empty($ticket)) {
            return $ticket;
        }

        $result = $this->parseJSON('get', [self::API_TICKET]);

        $this->getCache()->save($key, $result['ticket'], $result['expires_in'] - 500);

        return $result['ticket'];
    }
344282
public function is_valid()
    {
        $isauthority = $this->iuserinfo !== null || $this->ihost !== null || $this->port !== null;
        if ($this->ipath !== '' &&
            (
                $isauthority && (
                    $this->ipath[0] !== '/' ||
                    substr($this->ipath, 0, 2) === '//'
                ) ||
                (
                    $this->scheme === null &&
                    !$isauthority &&
                    strpos($this->ipath, ':') !== false &&
                    (strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/'))
                )
            )
        )
        {
            return false;
        }

        return true;
    }
672915
public function getTicket()
    {
        $key = 'stoneworld.wechat.jsapi_ticket.' . $this->appId;

        // for php 5.3
        $appId = $this->appId;
        $appSecret = $this->appSecret;
        $cache = $this->cache;
        $apiTicket = self::API_TICKET;

        return $this->cache->get(
            $key,
            function ($key) use ($appId, $appSecret, $cache, $apiTicket) {
                $http = new Http(new AccessToken($appId, $appSecret));

                $result = $http->get($apiTicket);

                $cache->set($key, $result['ticket'], $result['expires_in']);

                return $result['ticket'];
            }
        );
    }
843597
public function validate($validator)
    {
        // Throw an error when there are no tickets selected
        if (empty($this->value)) {
            $validator->validationError($this->name, _t(
                'TicketsField.VALIDATION_EMPTY',
                'Select at least one ticket'
            ), 'validation');

            return false;
        }

        // Get the availability
        $available = $this->getForm()->event->getAvailability();
        // get the sum of selected tickets
        $ticketCount = array_sum(array_map(function ($item) {
            return $item['Amount'];
        }, $this->value));

        // If the sum of tickets is 0 trow the same error as empty
        if ($ticketCount === 0) {
            $validator->validationError($this->name, _t(
                'TicketsField.VALIDATION_EMPTY',
                'Select at least one ticket'
            ), 'validation');

            return false;
        }

        // Throw an error when there are more tickets selected than available
        if ($ticketCount > $available) {
            $validator->validationError($this->name, _t(
                'TicketsField.VALIDATION_TO_MUCH',
                'There are {ticketCount} tickets left',
                null,
                array(
                    'ticketCount' => $available
                )
            ), 'validation');

            return false;
        }

        return false;
    }
1211128
public function IsAvailable()
    {
        $bIsValid = true;
        $bIsValid = ($bIsValid && $this->IsActive());
        $bIsValid = ($bIsValid && $this->isValidForCurrentPortal());
        $bIsValid = ($bIsValid && $this->IsValidForCurrentUser());
        $bIsValid = ($bIsValid && $this->IsValidForBasket());

        return $bIsValid;
    }
1367688
public function ticket($forceRefresh = false)
    {
        $cacheKey = [__CLASS__, 'appId' => Yii::$app->wechat->appId];
        if ($forceRefresh || ($ticket = Yii::$app->wechat->cache->get($cacheKey)) === false) {
            $response = $this->post(self::API_TICKET, ['type' => 'jsapi']);
            Yii::$app->wechat->cache->set($cacheKey, $response['ticket'], $response['expires_in'] - 500);
            return $response['ticket'];
        }
        return $ticket;
    }
1255951
public function isAvailable(): bool
    {
        foreach ($this->items as $item) {
            if ($item->isVisible()) {
                return true;
            }
        }

        return false;
    }
1317728
public function isAvailable()
    {
        $isDebugging = $this->_logger->isHandling(ehough_epilog_Logger::DEBUG);

        if (! function_exists('fopen')) {

            if ($isDebugging) {

                $this->_logger->debug('fopen() is not available.');
            }

            return false;
        }

        if (function_exists('ini_get') && ini_get('allow_url_fopen') != true) {

            if ($isDebugging) {

                $this->_logger->debug('allow_url_fopen is set to false.');
            }

            return false;
        }

        return true;
    }
996365
public static function check()
    {
        $route = isset($_GET['_framework_url_']) ? $_GET['_framework_url_'] : '';

        $out = config('maintenance.out', []);

        $out[] = config('panel.route', 'vinala');

        if (config('panel.setup', true)) {
            if (config('maintenance.enabled', false) && !in_array($route, $out)) {
                return static::$enabled = true;
            }
        }

        return static::$enabled = false;
    }
558868
public function check()
    {
        if ($this->user !== null) {
            return $this->user;
        }

        if (! $code = $this->persistences->check()) {
            return false;
        }

        if (! $user = $this->persistences->findUserByPersistenceCode($code)) {
            return false;
        }

        if (! $this->cycleCheckpoints('check', $user)) {
            return false;
        }

        return $this->user = $user;
    }
832666
public function IsAvailable()
    {
        $bIsValid = $this->isAvailableIgnoreGroupRestriction();

        if ($bIsValid) {
            // check group restrictions
            $aShippingGroupIdList = array();
            $oShippingGroup = TShopBasket::GetInstance()->GetAvailableShippingGroups();
            if (null !== $oShippingGroup) {
                $aShippingGroupIdList = $oShippingGroup->GetIdList();
            }
            $bAllowedForCurrentAvailableShippingGroupList = $this->allowedForShippingGroupList($aShippingGroupIdList);

            $bIsValid = ($bIsValid && $bAllowedForCurrentAvailableShippingGroupList);
        }

        return $bIsValid;
    }