/*!
\static
Goes trough all attributes and fetches metadata for the ones that is searchable.
\return an array with metadata information.
13269
static function metaDataArray( &$attributes, $skipRelationAttributes = false )
    {
        $metaDataArray = array();
        if ( !is_array( $attributes ) )
            return false;
        foreach( $attributes as $attribute )
        {
            $classAttribute = $attribute->contentClassAttribute();
            if ( !$classAttribute->attribute( 'is_searchable' ) )
            {
                continue;
            }

            $datatype = $attribute->dataType();
            if ( $skipRelationAttributes && $datatype->isRelationType() )
            {
                continue;
            }

            $attributeMetaData = $datatype->metaData($attribute);
            if ( $attributeMetaData !== false )
            {
                if ( !is_array( $attributeMetaData ) )
                {
                    $attributeMetaData = array( array( 'id' => '',
                                                       'text' => $attributeMetaData ) );
                }
                $metaDataArray = array_merge( $metaDataArray, $attributeMetaData );
            }
        }
        return $metaDataArray;
    }
594787
public function getMetadata()
    {
        if ($this->cacheGenerated !== null) {
            $xml = $this->getCacheItem($this->cacheId, $this->cacheTag);
            if ($xml !== null) {
                Logger::debug($this->logLoc.'Loaded generated metadata from cache.');
                return $xml;
            }
        }

        return $this->updateCachedMetadata();
    }
114903
final public function getMetadata()
  {
    $item = Container::cache('target')->getItem('metadata');

    if (!$item->isHit()) {
      $metadata = [];
      $reflection = new \ReflectionClass($this);
      $interfaces = $reflection->getInterfaces();
      $reader = new AnnotationReader();

      foreach ($interfaces as $interface) {
        $methods = $interface->getMethods(\ReflectionMethod::IS_PUBLIC);
        foreach ($methods as $method) {
          $annotation = $reader->getMethodAnnotation($method, 'Drutiny\Annotation\Metadata');
          if (empty($annotation)) {
            continue;
          }
          $metadata[$annotation->name] = $method->name;
        }
      }
      Container::cache('target')->save($item->set($metadata));
    }
    return $item->get();
  }
1224413
public function getData()
    {
        $data = [];
        /** @var MetaDataGeneratorInterface $generator */
        foreach ($this->data as $generator) {
            $data = array_merge($data, $generator->getData());
        }
        return $data;
    }
359951
function dataMap()
    {
        // Retrieve the indexed information collection attributes
        $informationCollectionAttributes = $this->informationCollectionAttributes();

        $retArray = array();

        // Loop through each attribute hashing the array with the
        // class attribute identifier associated with the information
        // collection attribute
        foreach ( $informationCollectionAttributes as $informationAttribute )
        {
            $contentClassAttribute = $informationAttribute->attribute( 'contentclass_attribute' );
            $id = $contentClassAttribute->attribute( 'identifier' );
            $retArray[$id] = $informationAttribute;
        }

        return $retArray;
    }
882608
public function getItemSchema()
	{
		$attributes = $this->_getManager()->getSearchAttributes( false );
		return array(
			'name' => $this->_name,
			'properties' => $this->_getAttributeSchema( $attributes ),
		);
	}
210503
public function getItems()
    {
        if (is_array($this->items)) {
            $this->items = new static($this->items, $this->serviceDescription);
            $this->items->setParent($this);
        }

        return $this->items;
    }
1153627
public function getAttributes()
    {
        if ($this->cachedAttributes != null) {
          return $this->cachedAttributes;
        }

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

        /** $entry DOMNode */
        foreach ($entries as $entry) {
            $attributeName = $entry->attributes->getNamedItem('Name')->nodeValue;

            // Keep only one value for each entry type
            foreach ($entry->childNodes as $childNode) {
                if (is_a($childNode, 'DOMElement') && preg_match('/AttributeValue/',$childNode->tagName)){
                    $attributeValue = $childNode->nodeValue;
                }
            }

            $this->cachedAttributes[$attributeName] = $attributeValue;
        }
        return $this->cachedAttributes;
    }
1033911
function getMetadataCache() {
		if (!isset($this->metadatCache)) {
			$this->metadataCache = static::$defaultMetadataCache ?: new Table\StaticCache;
		}
		return $this->metadataCache;
	}
1342396
protected function _getItemsData()
    {
        $attribute = $this->getAttributeModel();
        $this->_requestVar = $attribute->getAttributeCode();

        /** @var \Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection $productCollection */
        $productCollection = $this->getLayer()->getProductCollection();
        $facets = $productCollection->getFacetedData($this->getFilterField());

        $minValue = false;
        $maxValue = false;

        $data = [];
        if (count($facets) > 1) {
            foreach ($facets as $key => $aggregation) {
                $count = $aggregation['count'];
                $data[] = ['label' => $key, 'value' => $key, 'count' => $count];

                if ($minValue === false || $minValue > $key) {
                    $minValue = $key;
                }

                if ($maxValue === false || $maxValue < $key) {
                    $maxValue = $key;
                }
            }

            $this->setMinValue($minValue);
            $this->setMaxValue($maxValue);
        }

        return $data;
    }
654227
protected function collectMetaDataFromConnector()
    {
        $ret = array();

        $storeMeta = $this->getStoreMeta();

        // Std meta tags
        foreach ($storeMeta['meta'] as $metaKey => $metaValue) {
            if ($metaValue === null) {
                // Remove meta
                unset($this->tsSetupSeo[$metaKey]);
            } elseif (!empty($metaValue)) {
                $this->tsSetupSeo[$metaKey] = trim($metaValue);
            }
        }

        // Custom meta tags
        foreach ($storeMeta['custom'] as $metaKey => $metaValue) {
            if ($metaValue === null) {
                // Remove meta
                unset($ret[$metaKey]);
            } elseif (!empty($metaValue)) {
                $ret[$metaKey] = trim($metaValue);
            }
        }

        return $ret;
    }
934312
public function getAttributes()
    {

        // initialize the array with the attributes
        $attributes = array();

        // prepare the pattern to filter the attributes
        $pattern = sprintf('%s-*', $this->getSerial());

        // prepare the array with the attributes
        foreach ($this as $key => $value) {
            if (fnmatch($pattern, $key)) {
                $attributes[$key] = $value;
            }
        }

        // return the attributes
        return $attributes;
    }
501364
public function getMetadata($key = null)
    {
        if (!$key) {
            return $this['metadata'];
        }

        if (isset($this->definition['metadata'][$key])) {
            return $this->definition['metadata'][$key];
        }

        return null;
    }
365420
public function meta()
    {
        $meta = [];

        // look for basic parameters of transactions, only unconfirmed
        // transactions will have those fields empty.

        if (isset($this->attributes["id"]))
            $meta["id"] = (int) $this->attributes["id"];

        if (isset($this->attributes["height"]))
            $meta["height"] = (int) $this->attributes["height"];

        if (isset($this->attributes["hash"]))
            $meta["hash"] = ["data" => $this->attributes["hash"]];

        return $meta;
    }
1170504
public function getMetaData(string $path): array
    {
        $location = $this->applyBasePath($path);
        $info     = new SplFileInfo($location);
        $metadata = $this->normalizeFileInfo($info);

        unset($location, $info);

        return $metadata === null ? [] : $metadata;
    }
971067
public function toArray(): array
    {
        $data = $this->resourceToArray();

        if ($this->hasMetadata()) {
            $data['meta'] = $this->getMetadata();
        }

        return $data;
    }
221660
protected static function _finders() {
		$self = static::_object();

		return [
			'all' => function($params, $next) {
				return $next($params);
			},
			'first' => function($params, $next) {
				$options =& $params['options'];
				$options['limit'] = 1;

				$data = $next($params);

				if (isset($options['return']) && $options['return'] === 'array') {
					$data = is_array($data) ? reset($data) : $data;
				} else {
					$data = is_object($data) ? $data->rewind() : $data;
				}
				return $data ?: null;
			},
			'list' => function($params, $next) use ($self) {
				$result = [];
				$meta = $self::meta();
				$name = $meta['key'];

				foreach ($next($params) as $entity) {
					$key = $entity->{$name};
					$result[is_scalar($key) ? $key : (string) $key] = $entity->title();
				}
				return $result;
			},
			'count' => function($params, $next) use ($self) {
				$options = array_diff_key($params['options'], $self->_query);

				if ($options && !isset($params['options']['conditions'])) {
					$options = ['conditions' => $options];
				} else {
					$options = $params['options'];
				}
				$options += ['type' => 'read', 'model' => $self];
				$query = $self::invokeMethod('_instance', ['query', $options]);
				return $self::connection()->calculation('count', $query, $options);
			}
		];
	}