mapAttrValues

@param array $attribs

@return  mixed
776851
protected static function mapAttrValues($attribs)
    {
        foreach (static::$trueValueMapping as $key => $value) {
            $attribs[$key] = !empty($attribs[$key]) ? $value : null;
        }

        return $attribs;
    }
1048777
protected function _mergeAttributes($attrs, $merge)
    {
        $appendable = array(
        'class' => array('separator' => ' ', 'match' => 'full'),
        'style' => array('separator' => ';', 'match' => 'part'),
        );

        foreach ((array)$merge as $attr => $values) {
            if (
            !array_key_exists($attr, $attrs)
            || empty($attrs[$attr]) && false !== $attrs[$attr]
            ) {
                $attrs[$attr] = $values;
                continue;
            } elseif (!in_array($attr, array_keys($appendable))) {
                continue;
            }

            if (!is_array($attrs[$attr])) {
                $attrs[$attr] = explode($appendable[$attr]['separator'], $attrs[$attr]);
                $implode = true;
            }

            if (!is_array($values)) {
                $values = explode($appendable[$attr]['separator'], $attrs[$attr]);
            }

            switch ($appendable[$attr]['match']) {

                case 'full':
                    foreach ($values as $value) {
                        if (!in_array($value, $attrs[$attr])) {
                            $attrs[$attr][] = $value;
                        }
                    }
                    break;

                case 'part':
                    foreach ($attrs[$attr] as $k => $haystack) {
                        if (empty($haystack)) {
                            unset($attrs[$attr][$k]);
                            continue;
                        }

                        if (false === strpos($haystack, $appendable[$attr]['separator'])) {
                            $attrs[$attr][$k] = $haystack . $appendable[$attr]['separator'];
                        }

                        foreach ($values as $n => $value) {
                            $needle = current(explode(':', $value)) . ':';
                            if (0 === strpos($haystack, $needle)
                                || false !== strpos($haystack, ';' . $needle)
                                || false !== strpos($haystack, '; ' . $needle)
                            ) {
                                unset($values[$n]);
                            }
                        }
                    }

                    foreach (array_keys($values) as $key) {
                        if (false === strpos($values[$key], $appendable[$attr]['separator'])) {
                            $values[$key] = $values[$key] . $appendable[$attr]['separator'];
                        }
                        $attrs[$attr][] = $values[$key];
                    }
                    break;

                default:
            }

            if (isset($implode)) {
                $attrs[$attr] = implode(' ', $attrs[$attr]);
            }
        }

        return $attrs;
    }
178812
public function attrs($attrs) {
		if (is_array($attrs) && !empty($attrs))
			return $this->merge(['query.attrs' => $attrs]);
		else
			return $this->merge(['query.attrs' => func_get_args()]);
	}
853201
public function normalizeFKey($attrib)
    {
        if ($attrib === null || strtoupper($attrib) == "NONE") {
            $attrib = self::NONE;
        }
        $attrib = strtoupper($attrib);
        if ($attrib == "SETNULL") {
            $attrib = self::SETNULL;
        }

        return $attrib;
    }
883528
public function getAttributes()
    {
        $attribs = [];
        foreach (array_keys($this->attributeSetters) as $setter) {
            $attribs[] = $this->getPropertyName($setter, "set");
        }

        return $attribs;
    }
1113333
protected function setAttributes(Metadata\Interfaces\AttributeInterface $metadata, array $attrMapping)
    {
        foreach ($attrMapping as $key => $mapping) {
            if (!is_array($mapping)) {
                $mapping = ['type' => null];
            }

            if (!isset($mapping['type'])) {
                $mapping['type'] = null;
            }

            if (!isset($mapping['search'])) {
                $mapping['search'] = [];
            }

            $attribute = new Metadata\AttributeMetadata($key, $mapping['type'], $this->isMixin($metadata));

            if (isset($mapping['description'])) {
                $attribute->description = $mapping['description'];
            }

            if (isset($mapping['defaultValue'])) {
                $attribute->defaultValue = $mapping['defaultValue'];
            }

            if (isset($mapping['calculated']) && is_array($mapping['calculated'])) {
                $calculated = $mapping['calculated'];
                if (isset($calculated['class']) && isset($calculated['method'])) {
                    $attribute->calculated['class']  =  $calculated['class'];
                    $attribute->calculated['method'] =  $calculated['method'];
                }
            }

            if (isset($mapping['search']['autocomplete'])) {
                $attribute->setAutocomplete(true);
            } else if (isset($mapping['search']['store'])) {
                $attribute->setSearchProperty(true);
            }

            if (isset($mapping['save'])) {
                $attribute->enableSave($mapping['save']);
            }

            if (isset($mapping['serialize'])) {
                $attribute->enableSerialize($mapping['serialize']);
            }

            $metadata->addAttribute($attribute);
        }
        return $metadata;
    }
1372876
static public function linkify($text, array $attribs = array()) {
        return self::linkUrls(self::linkEmailAddresses($text, $attribs), $attribs);
    }
1098182
public static function mapAttributes($attributes)
    {
        return ' '.implode(' ', array_map(
            function ($sKey) use ($attributes) {
                return is_bool($attributes[$sKey]) ? ($attributes[$sKey] ? $sKey : '') : $sKey.'="'.$attributes[$sKey].'"';
            }, array_keys($attributes)
        ));
    }
585243
public function prepareAttributes()
    {
        $attrs = [];

        $this->prepare($attrs);

        $attrs = array_merge($attrs, (array) $this->getAttribute('attribs'));

        return $attrs;
    }
825467
protected function mapField($attibute)
    {
        $field = array();
        foreach ($attibute as $key => $value) {
            switch ($key) {
                case 'name':
                    $field['name'] = $this->uctToUtf($value);
                    break;
                case 'datatype':
                    $field['type'] = $value;
                    break;
                case 'desc':
                    $field['description'] = $this->uctToUtf($value);
                    break;
                case 'required':
                    $field['is_required'] = (bool) $value;
                    break;
            }
        }

        return $field;
    }
263254
public function addMapping($attributeName, $mappings)
    {
        if (!is_array($mappings)) {
            $mappings = [$mappings];
        }
        if (!$this->hasMapping($attributeName)) {
            $this->mappingsContainer[$attributeName] = [];
        }
        if ($this->mappingsContainer[$attributeName] !== null) {
            foreach ($mappings as $mapping) {
                $this->mappingsContainer[$attributeName][] = $mapping;
            }
        }
        return $this;
    }
619621
public function render($content, array $attribs = [])
    {
        if (isset($attribs['tagName'])) {
            $tagName = $attribs['tagName'];
            unset($attribs['tagName']);
        } else {
            $tagName = $this->getTagName();
        }

        if (!$tagName) {
            return $this->renderContent($content);
        }

        if (!$content && !$this->closeTag) {
            $openTag = trim($this->getOpenTag($tagName, $attribs));
            return substr_replace($openTag, $this->getClosingBracket(), -1);
        }

        return $this->getOpenTag($tagName, $attribs) .
            $this->renderContent($content) .
            $this->getCloseTag($tagName);
    }
1051378
public function addItems($items = null, $attribs = [])
    {
        $this->configure(
            $items,
            function (KeyValueGrid $grid, $key, $value) use ($attribs) {
                $grid->addItem($key, $value, $attribs);
            }
        );

        return $this;
    }
1134738
public static function element( $element, array $attribs = array(), $content = '' ) {
		return self::rawElement( $element, $attribs, strtr( $content, array(
			'&' => '&amp;',
			'<' => '&lt;',
		) ) );
	}
267260
public function setHintAttributes(array $attribs)
    {
        foreach ($attribs as $a => $v) {
            $this->setHintAttribute($a, $v);
        }
        return $this;
    }
1258356
private function parse_attribs($attribs)
	{
		$ret     = array('default' => null);
		$attribs = trim($attribs);

		if($attribs == '')
			return $ret;

		// if this tag only has one = then there is only one attribute
		// so add it all to default
		if($attribs[0] == '=' && strrpos($attribs, '=') === 0)
			$ret['default'] = htmlentities(substr($attribs, 1), ENT_QUOTES | ENT_IGNORE, "UTF-8");
		else
		{
			preg_match_all('/(\S+)=((?:(?:(["\'])(?:\\\3|[^\3])*?\3))|(?:[^\'"\s]+))/',
				$attribs,
				$matches,
				PREG_SET_ORDER);

			foreach($matches as $match)
				$ret[$match[1]] = htmlentities($match[2], ENT_QUOTES | ENT_IGNORE, "UTF-8");
		}

		return $ret;
	}
1039781
protected function replaceMapping($entityMetadata, &$stub)
    {
        $attributes = [];
        foreach ($entityMetadata['attributes'] as $attributeMetadata) {
            $attributes[$attributeMetadata['name']] = $attributeMetadata['columnName'];
        }

        $embeddeds = [];
        foreach ($entityMetadata['embeddeds'] as $embeddedMetadata) {
            $embedded = [];
            $embedded['class'] = $embeddedMetadata['class'];
            $embedded['columnPrefix'] = $embeddedMetadata['columnPrefix'];
            $embeddedAttributes = [];
            foreach ($embeddedMetadata['attributes'] as $attributeMetadata) {
                $embeddedAttributes[$attributeMetadata['name']] = $attributeMetadata['columnName'];
            }
            $embedded['attributes'] = $embeddedAttributes;
            $embeddeds[$embeddedMetadata['name']] = $embedded;
        }

        $relations = [];
        foreach ($entityMetadata['relations'] as $relationMetadata) {
            $relation = [];
            
            $relation['type'] = $relationMetadata['type'];
            if ($relation['type'] == 'belongsToMany' || $relation['type'] == 'morphToMany') {
                $relation['inverse'] = (! empty($relationMetadata['options']['inverse']));
            }

            $relations[$relationMetadata['name']] = $relation;
        }

        $mapping = [
            'attributes' => $attributes,
            'embeddeds' => $embeddeds,
            'relations' => $relations,
        ];

        $stub = str_replace('{{mapping}}', $this->getArrayAsText($mapping), $stub);
    }