创建主题
@param string $topicName
@param null $attributes
@return array
191600
public function createTopic(string $topicName, $attributes=null) {
        if(!$topicName){
            return $this->error('参数有误');
        }
        $request = new CreateTopicRequest($topicName, $attributes);
        try{
            $this->client->createTopic($request);
            return $this->success('创建主题成功');
        }catch(MnsException $exception){
            return $this->parseException($exception, '创建主题');
        }
    }
578013
function(node, attributeName) {
			var out = [],
				attList;

			attList = node.getAttribute(attributeName);
			if(attList && attList !== '') {
				if(attList.indexOf(' ') > -1) {
					out = attList.split(' ');
				} else {
					out.push(attList);
				}
			}
			return out;
		}
950658
public function topic()
    {
        if ($this->info['topic']) {
            return new Topic(
                $this->connection,
                $this->projectId,
                $this->info['topic'],
                $this->encode,
                [],
                $this->clientConfig
            );
        }

        return null;
    }
1162644
public static function getTopics(Core $core, $limit = 100, $offset = 0) {
		$url = self::getTopicsUrl($core) . "?limit=" . $limit . "&offset=" . $offset; 

		$response = Client::GET($url, self::getHeaders($core));
		
		$body = self::getDataFromResponse($response);
		if (!property_exists($body, "topics")) {
			return null;
		}

		$topics = array();
		foreach ($body->{"topics"} as &$topic) {
			$topics[] = Topic::serializeFromJson($topic);
		}

		return $topics;
	}
405983
public synchronized Topic getTopic(String topicName) {
        if (topicName == null || topicName.length() == 0) {
            throw new JavametricsException("Topic names must not be null or 0 length");
        }
        if (topics.containsKey(topicName)) {
            return topics.get(topicName);
        } else {
            Topic topic = new TopicImpl(topicName);
            topics.put(topicName, topic);
            return topic;
        }
    }
52393
public static function getCustomAttribute( $tag, $attributeName )
    {
        foreach ( $tag->attributes as $attribute )
        {
            if ( $attribute->name === $attributeName
              && $attribute->namespaceURI === 'http://ez.no/namespaces/ezpublish3/custom/' )
            {
                return $attribute->value;
            }
        }
        return null;
    }
1172689
public String getPrincipalAttributeValue(final Principal p, final String attributeName) {
        val attributes = p.getAttributes();
        if (attributes.containsKey(attributeName)) {
            return CollectionUtils.toCollection(attributes.get(attributeName)).iterator().next().toString();
        }
        return null;
    }
355684
private function _getAttributesByKeyName($keyName="Name")
    {
        $attributes = array();

        $entries = $this->_queryAssertion('/saml:AttributeStatement/saml:Attribute');

        /** @var $entry DOMNode */
        foreach ($entries as $entry) {
            $attributeKeyNode = $entry->attributes->getNamedItem($keyName);

            if ($attributeKeyNode === null) {
                continue;
            }

            $attributeKeyName = $attributeKeyNode->nodeValue;

            if (in_array($attributeKeyName, array_keys($attributes))) {
                throw new OneLogin_Saml2_ValidationError(
                    "Found an Attribute element with duplicated ".$keyName,
                    OneLogin_Saml2_ValidationError::DUPLICATED_ATTRIBUTE_NAME_FOUND
                );
            }

            $attributeValues = array();
            foreach ($entry->childNodes as $childNode) {
                $tagName = ($childNode->prefix ? $childNode->prefix.':' : '') . 'AttributeValue';
                if ($childNode->nodeType == XML_ELEMENT_NODE && $childNode->tagName === $tagName) {
                    $attributeValues[] = $childNode->nodeValue;
                }
            }

            $attributes[$attributeKeyName] = $attributeValues;
        }
        return $attributes;
    }
452373
public function getAttributeValueByName($attributeValueName)
    {
        /** @var AttributeValueInterface $attributeValue */
        foreach ($this->attributeValues as $attributeValue) {
            if ($attributeValue->getAttributeName() == $attributeValueName) {
                return $attributeValue;
            }
        }

        return null;
    }
116892
public function radio($fieldName, $options = array(), $attributes = array()) {
		$attributes = $this->_initInputField($fieldName, $attributes);
		$showEmpty = $this->_extractOption('empty', $attributes);
		if ($showEmpty) {
			$showEmpty = ($showEmpty === true) ? __d('cake', 'empty') : $showEmpty;
			$options = array('' => $showEmpty) + $options;
		}
		unset($attributes['empty']);

		$legend = false;
		if (isset($attributes['legend'])) {
			if ($attributes['legend'] === true) {
				$legend = __(Inflector::humanize($this->field()));
			} else {
				$legend = $attributes['legend'];
			}
			unset($attributes['legend']);
		}

		$label = true;
		if (isset($attributes['label'])) {
			$label = $attributes['label'];
			unset($attributes['label']);
		}

		$separator = null;
		if (isset($attributes['separator'])) {
			$separator = $attributes['separator'];
			unset($attributes['separator']);
		}

		$between = null;
		if (isset($attributes['between'])) {
			$between = $attributes['between'];
			unset($attributes['between']);
		}

		// Opcion inline
		$inline = null;
		if ($this->_getCustom('inline')) {
			$inline = $this->_getCustom('inline');
			unset($attributes['inline']);
		}

		$value = null;
		if (isset($attributes['value'])) {
			$value = $attributes['value'];
		} else {
			$value = $this->value($fieldName);
		}

		$disabled = array();
		if (isset($attributes['disabled'])) {
			$disabled = $attributes['disabled'];
		}

		$out = array();

		$hiddenField = isset($attributes['hiddenField']) ? $attributes['hiddenField'] : true;
		unset($attributes['hiddenField']);

		if (isset($value) && is_bool($value)) {
			$value = $value ? 1 : 0;
		}

		$this->_domIdSuffixes = array();
		foreach ($options as $optValue => $optTitle) {
			$optionsHere = array('value' => $optValue, 'disabled' => false);

			if (isset($value) && strval($optValue) === strval($value)) {
				$optionsHere['checked'] = 'checked';
			}
			$isNumeric = is_numeric($optValue);
			if ($disabled && (!is_array($disabled) || in_array((string)$optValue, $disabled, !$isNumeric))) {
				$optionsHere['disabled'] = true;
			}
			$tagName = $attributes['id'] . $this->domIdSuffix($optValue);

			if (is_array($between)) {
				$optTitle .= array_shift($between);
			}
			$allOptions = array_merge($attributes, $optionsHere);

			$allOptions['class'] = null;
			if (isset($options['class'])) {
				$allOptions['class'] = $options['class'];
			}
			$optHtml = $this->Html->useTag('radio', $attributes['name'], $tagName,
				array_diff_key($allOptions, array('name' => null, 'type' => null, 'id' => null)),
				''
			);

			// Wraps radio inside label
			$labelOpts = array();
			$labelOpts += array('for' => $tagName);

			if ($inline) {
				$labelOpts['class'] = 'radio-inline';
			}
			$optLabel = $this->label($tagName, $optHtml . ' ' . $optTitle, $labelOpts);

			// If it is not an inline group, wrap input inside div.radio
			if (!$inline) {
				$optLabel = $this->Html->tag('div', $optLabel, array('class' => 'radio'));
			}

			$out[] = $optLabel;
		}
		$hidden = null;

		if ($hiddenField) {
			if (!isset($value) || $value === '') {
				$hidden = $this->hidden($fieldName, array(
					'id' => $attributes['id'] . '_', 'value' => '', 'name' => $attributes['name']
				));
			}
		}
		$out = $hidden . implode($separator, $out);

		if (is_array($between)) {
			$between = '';
		}
		if ($legend) {
			$out = $this->Html->useTag('fieldset', '', $this->Html->useTag('legend', $legend) . $between . $out);
		}

		return $out;
	}
1211930
function(node, tagNames, attributeName) {
			var i = tagNames.length;

			while(i--) {
				if(node.tagName.toLowerCase() === tagNames[i]) {
					var attrValue = this.getAttribute(node, attributeName);
					if(attrValue && attrValue !== '') {
						return attrValue;
					}
				}
			}
			return null;
		}
322128
protected function getAttributesByFieldNameAndValues(string $fieldName, $values)
    {
        $attributes = [];

        if (empty($values) || empty($this->attributes)) {
            return $attributes;
        }

        foreach ($this->attributes as $attribute) {
            if (in_array($attribute->{$fieldName}, $values)) {
                $attributes[] = $attribute;
            }
        }

        return $attributes;
    }
932348
public function findOne($attributes, $uri)
    {
        $where      = [
            'resource' => $uri,
            'name'     => snake_case(array_get($attributes, 'name'))
        ];
        $components = $this->components->filter(function($item) use($where) {
            return $item->resource == array_get($where, 'resource') && $item->name == array_get($where, 'name');
        });
        $component = $components->count() ? $components->first() : null;
        if (!is_null($component)) {
            return array_merge($component->data, ['id' => $component->id]);
        }
        return [];
    }
706230
public static function getAttributesCollection($attributes, $padding=1) {
      /** one space to seperate namespace **/
      $attrs = str_repeat(" ", $padding);
      foreach ($attributes as $attr) {
        $attrs .= $attr->getKey() . "=" . '"' . $attr->getValue() . '" ';
      }

      return substr($attrs, 0, strlen($attrs) - 1);
    }
5894
private static function setDefaultAttributes(array $attributes, array $default): array
    {
        foreach ($default as $name => $value) {
            if (!\array_key_exists($name, $attributes)) {
                $attributes[$name] = $value;
            }
        }
        return $attributes;
    }
1084999
public static function getRequiredAttributeValue(DOMElement $node, $attributeName)
    {
        $attributeName = (string)$attributeName;

        $attribute = $node->attributes->getNamedItem($attributeName);
        if (!$attribute) {
            $errMsg = "Отсутствует атрибут {$attributeName} у тега {$node->nodeName}";
            $exception =  new NotExistsRequiredAttributeException($errMsg);
            $exception->setRequiredAttributeName($attributeName);

            throw $exception;
        }

        $value = $attribute->nodeValue;

        return $value;
    }
1278353
public function subscribe(string $topicName, string $subscribeName, $endPoint, $strategy = null, $contentFormat = null, $topicOwner = null, $createTime = null, $lastModifyTime = null) {
        if(!$topicName || !$subscribeName || !$endPoint){
            return $this->error('参数有误');
        }
        $topic = $this->client->getTopicRef($topicName);
        $attributes = new SubscriptionAttributes($subscribeName, $endPoint, $strategy, $contentFormat, $topicName, $topicOwner, $createTime, $lastModifyTime);
        try{
            $topic->subscribe($attributes);
            return $this->success('创建订阅成功');
        }catch(MnsException $exception){
            return $this->parseException($exception, '创建订阅');
        }
    }