Return a Yoti Attribute.

@param ProtobufAttribute $protobufAttribute

@return null|Attribute
12792
public static function convertToYotiAttribute(ProtobufAttribute $protobufAttribute)
    {
        $yotiAttribute = null;

        // Application Logo can be empty, return NULL when this occurs.
        if ($protobufAttribute->getName() == ApplicationProfile::ATTR_APPLICATION_LOGO &&
          empty($protobufAttribute->getValue())) {
            return $yotiAttribute;
        }

        try {
            $yotiAnchorsMap = AnchorListConverter::convert(
                $protobufAttribute->getAnchors()
            );
            $attrValue = AttributeConverter::convertValueBasedOnContentType(
                $protobufAttribute->getValue(),
                $protobufAttribute->getContentType()
            );
            $attrName = $protobufAttribute->getName();
            $attrValue = AttributeConverter::convertValueBasedOnAttributeName(
                $attrValue,
                $attrName
            );
            $yotiAttribute = new Attribute(
                $attrName,
                $attrValue,
                $yotiAnchorsMap
            );
        } catch (AttributeException $e) {
            error_log("{$e->getMessage()} (Attribute: {$protobufAttribute->getName()})", 0);
        } catch (\Exception $e) {
            error_log($e->getMessage(), 0);
        }

        return $yotiAttribute;
    }
989409
public static function makeFromAttribute( PgAttribute $attribute )
    {

        $name = $attribute->name;
        $entity = $attribute->getRelation()->getEntityName();
        $type = $attribute->getType();
        $fullyQualifiedName = $attribute->getFullyQualifiedName();

        $data = array(
            'isPrimaryKey' => $attribute->isPrimaryKey(),
            'isUnique' => $attribute->isUnique(),
            'isNullable' => !$attribute->notNull,
            'isArray' => $attribute->isArray,
            'isInherited' => $attribute->isInherited(),
            'type' => $type->getTypeQuery(),
            'length' => $attribute->length,
            'default' => $attribute->default,
        );

        $data += $attribute->getEntity();

        if( $type->isBool() and in_array( strtolower( $data['default'] ), array( 'true', 'false' ) ) ) {
            $data['default'] = \Bond\boolval( $data['default'] );
        }

        if( $type->isEnum() ) {
            $data['enumName'] = $type->name;
        }

        if( $tags = \Bond\extract_tags( $attribute->comment, 'form' ) ) {
            $data['form'] = $tags;
        }

        if( $tags = \Bond\extract_tags( $attribute->comment, 'api' ) ) {
            $data+= $tags;
        }

        if( $tags = \Bond\extract_tags( $attribute->comment, 'filter' ) ) {
            $data['filter'] = $tags;
        }

        if( $tags = \Bond\extract_tags( $attribute->comment, 'normality' ) ) {
            $data['isFormChoiceText'] = isset( $tags['form-choicetext'] );
            $data['isAutoComplete'] = isset( $tags['autoComplete'] );
        }

        return new static( $name, $entity, $fullyQualifiedName, $data );

    }
216155
function objectAttributeContent( $contentObjectAttribute )
    {
        $xmlText = $contentObjectAttribute->attribute( 'data_text' );
        if ( trim( $xmlText ) == '' )
        {
            $objectAttributeContent = $this->defaultObjectAttributeContent();
            return $objectAttributeContent;
        }
        $doc = $this->parseXML( $xmlText );
        $content = $this->createObjectContentStructure( $doc );

        return $content;
    }
1237236
public static function getAttributes($onlyAttributesOfSimpleDatatypes = false)
    {
        $oSelfReflection = new \ReflectionClass(static::$m__sClassName);
        $oPropertyArray = $oSelfReflection->getProperties(
            \ReflectionProperty::IS_PUBLIC |
            \ReflectionProperty::IS_PROTECTED |
            \ReflectionProperty::IS_PRIVATE);

        $count = 0;
        while ($count < count($oPropertyArray)) {
            $sAttributeName = $oPropertyArray[$count]->getName();
            if (
                // TODO generalize attribute prefix (sample "m_-s-", (start 2, length 1) )
                substr($sAttributeName, 1, 1) != "_" ||
                substr($sAttributeName, 2, 1) == "_" ||
                ($onlyAttributesOfSimpleDatatypes && substr($sAttributeName, 2, 1) == "o")
            ) {
                unset($oPropertyArray[$count]);
            }
            $count++;
        }
        return $oPropertyArray;
    }
180534
public function getNode($type, $content = null, $father = null)
    {
        if (!$content) {
            if ($father) {
                return $this->subContent->findOneBy(array('father' => $father, 'next' => null));
            }

            return $this->contentType->findOneBy(array('type' => $type, 'next' => null));
        }

        if ($father) {
            return $this->subContent->findOneBy(array('father' => $father, 'child' => $content));
        }

        return $this->contentType->findOneBy(array('type' => $type, 'content' => $content));
    }
1204985
public static function WithAttribute( $schemaAttribute )
	{
		$result = new SequenceType();

		$result->TypeCode = XmlTypeCode::Attribute;
		$result->SchemaAttribute = $schemaAttribute;
		$result->IsNode = true;
		$result->ItemType = $result->TypeCodeToItemType( $result->TypeCode, $result->SchemaType );

		return $result;
	}
431739
public static function isValidHtmlAttribute($htmlAttribute)
    {
        /*
         * Not a string?
         * Nothing to do
         */
        if (!is_string($htmlAttribute)) {
            return false;
        }

        $pattern = self::getHtmlAttributePattern();

        return (bool)preg_match($pattern, $htmlAttribute);
    }
1113124
public function toString($objectAttribute)
    {
        $value = $objectAttribute->content();
        $value = $value instanceof Value ? $value : $this->fieldType->getEmptyValue();

        return (string)$value;
    }
237228
public function getPictureBoxAttribute()
    {
        if ('image' != $this->attributes['type']) {
            return null;
        }

        $id = $this->id;
        $url = $this->url;
        $alt = $this->title;
        $title = $this->title;
        $description = $this->description;

        $srcsets = [];

        foreach ($this->thumbSizes() as $size => $value) {
            if ($thumb_url = $this->getUrlAttribute($size)) {
                $srcsets[] = (object) [
                    'size' => $value.'px',
                    'url' => $thumb_url,
                    'mime_type' => $this->attributes['mime_type'],
                ];
            }
        }

        return html_raw(view('shortcodes.picture_box',
            compact('id', 'url', 'alt', 'title', 'description', 'srcsets')
        ));
    }
77529
public function &getPrimaryAttribute()
    {
        if (count($this->primaryAttributes) != 1) {
            throw new \RuntimeException( 'There is not one primary attribute on the \'' . $this->getName() . '\' entity. (There are ' . count($this->getPrimaryAttributes()) . ')' );
        }

        return $this->primaryAttributes[array_keys($this->primaryAttributes)[0]];
    }
660082
public function getAttributeLines(CPPAttribute $attribute)
    {
        $lines = [];

        if ('object' === $attribute->getType()) {
            $lines[] = $attribute->getEntitySubtype()->getName() . ' ' . $attribute->getName() . ';';
        } else {
            $lines[] = $attribute->getType() . ' ' . $attribute->getName() . ';';
        }

        return $lines;
    }
64631
public function getGetterCodeLines(CPPAttribute $attribute)
    {
        $lines = [];

        $base = $this->getEntity()->getProject()->getAutocodeProperty('base');

        if ('object' === $attribute->getType()) {
            $lines[] = $attribute->getStatic()
                ? $attribute->getEntitySubtype()->getName() . ' ' . ($base ? $this->getEntity()->getNameBase() : $this->getEntity()->getName()) . '::' . $attribute->getGetterName() . '()'
                : $attribute->getEntitySubtype()->getName() . ' ' . ($base ? $this->getEntity()->getNameBase() : $this->getEntity()->getName()) . '::' . $attribute->getGetterName() . '()';
        } else {
            $lines[] = $attribute->getStatic()
                ? $attribute->getType() . ' ' . ($base ? $this->getEntity()->getNameBase() : $this->getEntity()->getName()) . '::' . $attribute->getGetterName() . '()'
                : $attribute->getType() . ' ' . ($base ? $this->getEntity()->getNameBase() : $this->getEntity()->getName()) . '::' . $attribute->getGetterName() . '()';
        }

        $lines[] = '{';
        $lines[] =     'return ' . $attribute->getName() . ';';
        $lines[] = '};';

        return $lines;
    }
709276
protected function getAttribute($data, $attribute)
	{
		if ($this->dataProvider instanceof CActiveDataProvider && $data->hasAttribute($attribute)) {
			return $data->{$attribute};
		}

		if ($this->dataProvider instanceof CArrayDataProvider || $this->dataProvider instanceof CSqlDataProvider) {
			if (is_object($data) && isset($data->{$attribute})) {
				return $data->{$attribute};
			}
			if (isset($data[$attribute])) {
				return $data[$attribute];
			}
		}
		return null;
	}
1098732
@Override
    public Object getAttribute(String name) {
        Object value = this.attributes.get(name);
        if (null == value && null != this.connection.getSSLContext()) {
            // special case logic for SSL based connections
            if (PEER_CERTS.equals(name)
                || SERVLET_CERTS.equals(name)) {
                value = getPeerCertificates();
            } else if (CIPHER_SUITE.equals(name)) {
                value = getCipherSuite();
            } else if (SSL_SESSION.equals(name)) {
                value = this.connection.getSSLContext().getSession();
            }
        }
        return value;
    }
754499
public function GetArticleAttributeValueListForAttributeNames(
        &$oArticle,
        $aAttributeNames,
        $sFieldName = 'system_name'
    ) {
        $aList = array();
        foreach ($aAttributeNames as $sAttributeName) {
            $aList[$sAttributeName] = $this->GetArticleAttributeValueForAttributeName(
                $oArticle,
                $sAttributeName,
                $sFieldName,
                false
            );
        }

        return $aList;
    }
1191428
function getAttribute($id, $disposition = self::ATTR_ALL, $csr = null)
    {
        if (empty($csr)) {
            $csr = $this->currentCert;
        }

        $attributes = $this->_subArray($csr, 'certificationRequestInfo/attributes');

        if (!is_array($attributes)) {
            return false;
        }

        foreach ($attributes as $key => $attribute) {
            if ($attribute['type'] == $id) {
                $n = count($attribute['value']);
                switch (true) {
                    case $disposition == self::ATTR_APPEND:
                    case $disposition == self::ATTR_REPLACE:
                        return false;
                    case $disposition == self::ATTR_ALL:
                        return $attribute['value'];
                    case $disposition >= $n:
                        $disposition -= $n;
                        break;
                    default:
                        return $attribute['value'][$disposition];
                }
            }
        }

        return false;
    }
835151
public function getScheme()
    {
        $isHttps = false;

        if ($this->headers->has('X_FORWARDED_PROTO') === true) {
            $headerValue = $this->headers->get('X_FORWARDED_PROTO');
            $isHttps = (strtolower($headerValue) === 'https');
        } else {
            $headerValue = $this->env->get('HTTPS');
            $isHttps = (empty($headerValue) === false && $headerValue !== 'off');
        }

        return $isHttps ? 'https' : 'http';
    }