Return a specific visa

@param Visa $visa

@return mixed|null
519797
public function getVisa($country_code)
    {
        /** @var Visa $visa */
        $visas = [];
        foreach ($this->visas as $visa) {
            if ($visa->getCountry()->getCode() == $country_code) {
                $visas[] = $visa;
            }
        }
        return $visas;
    }
1309352
public function getGatewayInstance($gateway = null)
    {
        require __DIR__ . '/vendor/autoload.php';

        foreach ($this->getGateways() as $id) {
            $class = \Omnipay\Common\Helper::getGatewayClassName($id);
            if (class_exists($class)) {
                \Omnipay\Omnipay::register($id);
            }
        }

        $instances = array();
        foreach (\Omnipay\Omnipay::find() as $id) {
            $instances[$id] = \Omnipay\Omnipay::create($id);
        }

        if (isset($gateway)) {
            return empty($instances[$gateway]) ? null : $instances[$gateway];
        }

        return $instances;
    }
590420
protected function iblockGetById($id)
    {
        $res = CIBlock::getList([], [
            'ID' => (int) $id,
            'CHECK_PERMISSIONS' => 'N',
        ]);

        return $res->fetch() ?: null;
    }
1317594
protected static function get_registration($confirmed = true) {
        global $DB;

        if (self::$registration === null) {
            self::$registration = $DB->get_record('registration_hubs', ['huburl' => HUB_MOODLEORGHUBURL]);
        }

        if (self::$registration && (bool)self::$registration->confirmed == (bool)$confirmed) {
            return self::$registration;
        }

        return null;
    }
1162086
final public function get($id = null)
    {
        if ($id !== null) {
            $this->where($this->pk, '=', $id);
            $this->pkval = $id;
        }

        return $this->_get();
    }
1269387
public function getServerCredential($credential)
    {
        $credentials = $this->getServerCredentials();

        return isset($credentials[$credential]) ? $credentials[$credential] : null;
    }
65958
public function &__get($property)
    {
        $value = null;
        switch ($property) {
            case 'url':
                if (isset($this->settings['url']))
                    return $this->settings['url'];
                break;
            case 'frequency':
                if (isset($this->settings['frequency']))
                    return $this->settings['frequency'];
                break;
            case 'nextCheck':
                if (isset($this->settings['next_check']))
                    return $this->settings['next_check'];
                break;
            case 'request':
                return $this->request;
            case 'data':
                return $this->data;
            case 'isOffline':
                $value = isset($this->settings['offline']);
                break;
            case 'isOfflineValid':
                $value = $this->isOffline
                    && ($this->settings['offline'] === true
                        || time() < $this->settings['offline']
                    );
                break;
            case 'isValid':
                $value = false;
                if (isset($this->settings['frequency'])
                    && !empty($this->settings['frequency'])
                    && isset($this->data)
                    && !empty($this->data)
                    && is_numeric($this->data['activation_id'])
                ) {
                    $value = $this->data['expire'] === null || time() < $this->data['expire'];
                }
                break;
            case 'isEmpty':
                $value = empty($this->data);
                break;
            case 'version':
                if (isset($this->settings['version']))
                    return $this->settings['version'];
                break;
            case 'retries':
                if (isset($this->settings['retries']))
                    return $this->settings['retries'];
                break;
        }
        return $value;
    }
427686
public function retrieveByCredentials(array $credentials)
	{
		if (Authorizer::validateAccessToken(false, $credentials[$this->token_key])) {
			$user_id = Authorizer::getResourceOwnerId();

			return $this->retrieveById($user_id);
		}

		return null;
	}
143635
public static function getData($authorization)
    {

        $data = null;

        // Reference
        if ($authorization->getReference() != null) {
            $data['reference'] = $authorization->getReference();
        }
        // RedirectURL
        if ($authorization->getRedirectURL() != null) {
            $data['redirectURL'] = $authorization->getRedirectURL();
        }
        // NotificationURL
        if ($authorization->getNotificationURL() != null) {
            $data['notificationURL'] = $authorization->getNotificationURL();
        }
        // Permissions
        if ($authorization->getPermissions()->getPermissions() != null) {
            $data['permissions'] = implode(',', $authorization->getPermissions()->getPermissions());
        }

        // parameter
        if (count($authorization->getParameter()->getItems()) > 0) {
            foreach ($authorization->getParameter()->getItems() as $item) {
                if ($item instanceof PagSeguroParameterItem) {
                    if (!PagSeguroHelper::isEmpty($item->getKey()) && !PagSeguroHelper::isEmpty($item->getValue())) {
                        if (!PagSeguroHelper::isEmpty($item->getGroup())) {
                            $data[$item->getKey() . '' . $item->getGroup()] = $item->getValue();
                        } else {
                            $data[$item->getKey()] = $item->getValue();
                        }
                    }
                }
            }
        }
        
        return $data;
    }
1244820
public function getCulture($culture = null): ?array
    {
        return $this->getCultures()[$culture] ?? (! empty($this->getCultures()) ? current($this->getCultures()) : null);
    }
781836
private function _getRestriction($data, $secodaryKey, $allowGlobal = true)
    {
        $restriction = [];

        if ($data) {
            $restriction[$secodaryKey] = $this->_getSecondaryKeys($data, $this->viaModel->formName());
        }

        if ($allowGlobal && $this->restriction) {
            $restriction = ArrayHelper::merge($restriction, $this->restriction);
        }

        return $restriction;
    }
785250
public static function get(string $target)
    {
        if (!self::has($target)) {
            return null;
        }

        if (!isset(self::$unserialized[$target])) {
            self::$unserialized[$target] = unserialize(self::$annotations[$target]);
        }

        return self::$unserialized[$target];
    }
1339468
public function get($header = null) {

        if (is_null($header)) {
            return $this->headers;
        }

        $index = $this->getIndexCaseInsensitive($header);

        return $index === null ? null : $this->headers[$index];

    }
546552
public function get($id)
    {
        $result = $this->query('+id:'.$id);

        if ($result->getNumFound() > 0) {
            $docs = $result->getDocs();

            return $docs[0];
        }

        return null;
    }
1119206
def get_queryset(self, request):
        """"""
        qs = super(VISADeviceAdmin, self).get_queryset(request)
        return qs.filter(protocol_id=PROTOCOL_ID)
431556
def is_visa(n):
    """"""
    n, length = str(n), len(str(n))

    if length >= 13 and length <= 16:
        if n[0] == '4':
            return True
    return False
1287162
public function getPermission($role)
    {
        if ($role instanceof RoleInterface || $role instanceof \Symfony\Component\Security\Core\Role\Role) {
            $role = $role->getRole();
        }
        if (isset($this->permissions[$role])) {
            return $this->permissions[$role];
        }

        return null;
    }