소스 검색

move if outside for loop

Thomas Flori 8 년 전
부모
커밋
9829979aea
1개의 변경된 파일10개의 추가작업 그리고 8개의 파일을 삭제
  1. 10 8
      src/Packagist/WebBundle/Package/Updater.php

+ 10 - 8
src/Packagist/WebBundle/Package/Updater.php

@@ -615,14 +615,16 @@ class Updater
             }
         }
 
-        // convert relative to absolute images
-        $images = $dom->getElementsByTagName('img');
-        foreach ($images as $img) {
-            if ($isGithub && false === strpos($img->getAttribute('src'), '//')) {
-                $img->setAttribute(
-                    'src',
-                    'https://raw.github.com/'.$owner.'/'.$repo.'/HEAD/'.$img->getAttribute('src')
-                );
+        if ($isGithub) {
+            // convert relative to absolute images
+            $images = $dom->getElementsByTagName('img');
+            foreach ($images as $img) {
+                if (false === strpos($img->getAttribute('src'), '//')) {
+                    $img->setAttribute(
+                        'src',
+                        'https://raw.github.com/'.$owner.'/'.$repo.'/HEAD/'.$img->getAttribute('src')
+                    );
+                }
             }
         }