/** * Filters client files * * @param array $files Files to be filtered * @param MetaDataContextInterface $context Metadata context * * @return array Filtered set of files */ protected static function filterClientFiles(array $files, MetaDataContextInterface $context) { $files = array_filter($files, function (array $file) use($context) { return $context->isValid($file); }); uasort($files, function ($a, $b) use($context) { return $context->compare($a, $b); }); return $files; }
/** * Gets the key used for the metadata hash cache store * * @param MetaDataContextInterface|null $context Metadata context * @return string The key for this platform and visibility version of metadata */ protected function getCachedMetadataHashKey(MetaDataContextInterface $context) { if ($this->public) { $prefix = 'public_'; } else { $hash = $context->getHash(); if ($hash) { $prefix = $hash . '_'; } else { $prefix = ''; } } $key = "meta_hash_{$prefix}" . implode("_", $this->platforms); return $key; }
/** {@inheritDoc} */ public function compare(array $a, array $b) { return $this->context->compare($a, $b); }