コード例 #1
0
ファイル: CacheStorage.php プロジェクト: ATouhou/speed-out
 public function testIsStored()
 {
     $storeId = $this->generateStoreId();
     $this->assertFalse($this->storage->isStored($storeId));
     $this->storage->store($storeId, 123);
     $this->assertTrue($this->storage->isStored($storeId));
 }
コード例 #2
0
ファイル: Combiner.php プロジェクト: ATouhou/speed-out
 /**
  * Replace resources links by one link on file, that contains resources links data
  * @param $html
  * @throws SpeedOut_DataHandler_Combiner_Exception_PathNotFound
  * @return null
  */
 public function handleData(&$html)
 {
     $this->handlingProcessData = array();
     $linksNodes = $this->getLinksNodes($html);
     if ($linksNodes) {
         $linksHash = $this->getLinksHash(array_keys($linksNodes));
         // combine and store links data
         if (!$this->storage->isStored($linksHash)) {
             $combinedData = '';
             $baseDir = $this->getLinksBaseDir();
             foreach ($linksNodes as $link => $data) {
                 $linkPath = SpeedOut_Utils::getLinkPath(SpeedOut_Utils::getRealLink(html_entity_decode($link), $baseDir), $baseDir);
                 $linkData = $this->getLinkData($linkPath);
                 $combinedData .= $this->getCombinedDataPart($linkData, $linkPath);
             }
             $this->handleCombinedData($combinedData);
             $this->storage->store($linksHash, $combinedData);
         }
         $html = str_replace($linksNodes, '', $html);
         $this->addStringInCommonPlaceholder($html, $this->getCommonLinkHtml($this->storage->getUrl($linksHash)));
     }
 }