/** * Find text resources (like JS and CSS) and return information about them. * * @param CelerityPhysicalResources Resource map to find text resources for. * @param CelerityResourceTransformer Configured resource transformer. * @return map<string, map<string, string>> Resource information map. */ private function rebuildTextResources(CelerityPhysicalResources $resources, CelerityResourceTransformer $xformer) { $text_map = $resources->findTextResources(); $result_map = array(); foreach ($text_map as $name => $data_hash) { $raw_data = $resources->getResourceData($name); $xformed_data = $xformer->transformResource($name, $raw_data); $data_hash = $resources->getCelerityHash($xformed_data); $hash = $resources->getCelerityHash($data_hash . $name); list($provides, $requires) = $this->getProvidesAndRequires($name, $raw_data); $result_map[$name] = array('hash' => $hash); if ($provides !== null) { $result_map[$name] += array('provides' => $provides, 'requires' => $requires); } } return $result_map; }