Add an association type and session type to the allowed types
list. The assocation/session pairs are tried in the order that
they are added.

@access private
@param $assoc_type
@param null $session_type
@return bool
339890
function addAllowedType($assoc_type, $session_type = null)
    {
        if ($this->allowed_types === null) {
            $this->allowed_types = array();
        }

        if ($session_type === null) {
            $available = Auth_OpenID_getSessionTypes($assoc_type);

            if (!$available) {
                return false;
            }

            foreach ($available as $session_type) {
                $this->addAllowedType($assoc_type, $session_type);
            }
        } else {
            if (Auth_OpenID_checkSessionType($assoc_type, $session_type)) {
                $this->allowed_types[] = array($assoc_type, $session_type);
            } else {
                return false;
            }
        }

        return true;
    }
889055
def add_type( type )
      hash = type.hash
      raise "upps #{hash} #{hash.class}" unless hash.is_a?(::Integer)
      was = types[hash]
      return was if was
      types[hash] = type
    end
970253
public function add($value, $type = 'n')
        {
            $this->session->put($type, $value);
            $this->session->push($this->key_name.'.new', $type);
            $this->removeFromOldFlashData([$type]);
        }
1283591
private function storeAssociationCache(QueryCacheKey $key, AssociationMetadata $association, $assocValue)
    {
        $unitOfWork     = $this->em->getUnitOfWork();
        $assocPersister = $unitOfWork->getEntityPersister($association->getTargetEntity());
        $assocMetadata  = $assocPersister->getClassMetadata();
        $assocRegion    = $assocPersister->getCacheRegion();

        // Handle *-to-one associations
        if ($association instanceof ToOneAssociationMetadata) {
            $assocIdentifier = $unitOfWork->getEntityIdentifier($assocValue);
            $entityKey       = new EntityCacheKey($assocMetadata->getRootClassName(), $assocIdentifier);

            if ((! $assocValue instanceof GhostObjectInterface && ($key->cacheMode & Cache::MODE_REFRESH)) || ! $assocRegion->contains($entityKey)) {
                // Entity put fail
                if (! $assocPersister->storeEntityCache($assocValue, $entityKey)) {
                    return null;
                }
            }

            return [
                'targetEntity'  => $assocMetadata->getRootClassName(),
                'identifier'    => $assocIdentifier,
            ];
        }

        // Handle *-to-many associations
        $list = [];

        foreach ($assocValue as $assocItemIndex => $assocItem) {
            $assocIdentifier = $unitOfWork->getEntityIdentifier($assocItem);
            $entityKey       = new EntityCacheKey($assocMetadata->getRootClassName(), $assocIdentifier);

            if (($key->cacheMode & Cache::MODE_REFRESH) || ! $assocRegion->contains($entityKey)) {
                // Entity put fail
                if (! $assocPersister->storeEntityCache($assocItem, $entityKey)) {
                    return null;
                }
            }

            $list[$assocItemIndex] = $assocIdentifier;
        }

        return [
            'targetEntity' => $assocMetadata->getRootClassName(),
            'list'         => $list,
        ];
    }
99569
public static function canAny($action, $objectType)
    {
        if (!isset($_SESSION['ACL_INFO'])) {
            return false;
        };
        $acl = $_SESSION['ACL_INFO'];
        foreach (array('*', $action) as $act) {
            if (array_key_exists($act, $acl)) {
                $acl2 = $acl[$act];
                foreach (array('*', $objectType) as $typ) {
                    if (array_key_exists($typ, $acl2)) {
                        foreach ($acl2[$typ] as $id) {
                            return true;
                        };
                    };
                };
            };
        };
        return false;
    }
1361514
public static <V> Optional<V> associated(Associator associator,
            Class<V> type, Serializable id) {
        return associator.associated(new TypedIdKey<>(type, id), type);
    }
1132990
private function applyJoins() : void
    {
        foreach ($this->getAssociations() as $association) {
            switch ($association->type()) {
                case Association::MANY_TO_ONE:
                    $this->query->leftJoinWith($association->getName());
                    break;

                case Association::ONE_TO_ONE:
                case Association::ONE_TO_MANY:
                case Association::MANY_TO_MANY:
                default:
                    break;
            }
        }
    }
871977
def db_set_assoc(self, server_url, handle, secret, issued, lifetime, assoc_type):
        
        result = self.db_get_assoc(server_url, handle)
        rows = self.cur.fetchall()
        if len(rows):
            # Update the table since this associations already exists.
            return self.db_update_assoc(secret, issued, lifetime, assoc_type,
                                        server_url, handle)
        else:
            # Insert a new record because this association wasn't
            # found.
            return self.db_new_assoc(server_url, handle, secret, issued,
                                     lifetime, assoc_type)
367980
private function addAddressArray(array $address_array, $type)
    {
        foreach ($address_array as $address => $name) {

            if (!method_exists($this, $type)) {
                return false;
            }

            if (is_int($address)) {
                $this->$type($name);
            } else {
                $this->$type($address, $name);
            }
        }

        return true;
    }
659529
protected function associate()
    {
        # Rejecting no-encryption without TLS.
        if(empty($_SERVER['HTTPS']) && $this->data['openid_session_type'] == 'no-encryption') {
            $this->directErrorResponse();
        }
        
        # Checking whether we support DH at all.
        if (!$this->dh && substr($this->data['openid_session_type'], 0, 2) == 'DH') {
            $this->redirect($this->response(array(
                'openid.error' => 'DH not supported',
                'openid.error_code' => 'unsupported-type',
                'openid.session_type' => 'no-encryption'
                )));
        }
        
        # Creating the association
        $this->assoc = array();
        $this->assoc['hash'] = $this->data['openid_assoc_type'] == 'HMAC-SHA256' ? 'sha256' : 'sha1';
        $this->assoc['handle'] = $this->assoc_handle();
        
        # Getting the shared secret
        if($this->data['openid_session_type'] == 'no-encryption') {
            $this->assoc['mac'] = base64_encode($this->shared_secret($this->assoc['hash']));
        } else {
            $this->dh();
        }
        
        # Preparing the direct response...
        $response = array(
            'ns'           => $this->ns,
            'assoc_handle' => $this->assoc['handle'],
            'assoc_type'   => $this->data['openid_assoc_type'],
            'session_type' => $this->data['openid_session_type'],
            'expires_in'   => $this->assoc_lifetime
            );
        
        if(isset($this->assoc['dh_server_public'])) {
            $response['dh_server_public'] = $this->assoc['dh_server_public'];
            $response['enc_mac_key'] = $this->assoc['mac'];
        } else {
            $response['mac_key'] = $this->assoc['mac'];
        }
        
        # ...and sending it.
        echo $this->keyValueForm($response);
        die();
    }
986275
public function addAutowiringType($type)
    {
        @trigger_error(sprintf('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".', $type), E_USER_DEPRECATED);

        $this->autowiringTypes[$type] = true;

        return $this;
    }
1081222
private static function check_type($type=null) {
	if (is_null($type)) {
		return self::TYPE_CONTINUOUS;
	}
	
	if (isset(self::$type_durations[$type]) == false) {
		$exception = bootstrap::get_library('exception');
		throw new $exception('unknown session type');
	}
	
	return $type;
}
13564
function setAllowedTypes($allowed_types)
    {
        foreach ($allowed_types as $pair) {
            list($assoc_type, $session_type) = $pair;
            if (!Auth_OpenID_checkSessionType($assoc_type, $session_type)) {
                return false;
            }
        }

        $this->allowed_types = $allowed_types;
        return true;
    }
727449
def in_resource(cls, session_type):
        
        if cls.resources is AllSessionTypes:
            return True
        return session_type in cls.resources
797278
public function getAssoc()
	{
		static $assoc = null;

		if (!is_null($assoc))
		{
			return $assoc;
		}

		$extension = $this->getState('category.extension');

		$assoc = JLanguageAssociations::isEnabled();
		$extension = explode('.', $extension);
		$component = array_shift($extension);
		$cname = str_replace('com_', '', $component);

		if (!$assoc || !$component || !$cname)
		{
			$assoc = false;
		}
		else
		{
			$hname = $cname . 'HelperAssociation';
			JLoader::register($hname, JPATH_SITE . '/components/' . $component . '/helpers/association.php');

			$assoc = class_exists($hname) && !empty($hname::$category_association);
		}

		return $assoc;
	}
1246927
protected function addUserFlash(SessionInterface $session, $type, $message)
    {
        $session->getFlashBag()->add($type, $message);
    }
906703
public function fetch($type=SQLAnywhereClient::FETCH_ASSOC)
	{
		$data = null;
		if ($this->result) {
			switch ($type) {
				case 'array':
					$data = sasql_fetch_array( $this->result );
				break;

				case 'assoc':
					$data = sasql_fetch_assoc( $this->result );
				break;

				case 'row':
					$data = sasql_fetch_row( $this->result );
				break;

				case 'field':
					$data = sasql_fetch_field( $this->result );
				break;

				case 'object':
					$data = sasql_fetch_object( $this->result );
				break;
				
				default:
					$data = sasql_fetch_array( $this->result );
				break;
			}		
		}
		return $data;
	}