Browse Source

Simplify conditions and inline temp variables

Gabriel Caruso 6 năm trước cách đây
mục cha
commit
2805a69e58
1 tập tin đã thay đổi với 2 bổ sung4 xóa
  1. 2 4
      src/Composer/Util/Perforce.php

+ 2 - 4
src/Composer/Util/Perforce.php

@@ -485,8 +485,7 @@ class Perforce
         $resArray = explode(PHP_EOL, $result);
         $tags = array();
         foreach ($resArray as $line) {
-            $index = strpos($line, 'Label');
-            if (!($index === false)) {
+            if (strpos($line, 'Label') !== false) {
                 $fields = explode(' ', $line);
                 $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
             }
@@ -502,8 +501,7 @@ class Perforce
         $result = $this->commandResult;
         $resArray = explode(PHP_EOL, $result);
         foreach ($resArray as $line) {
-            $index = strpos($line, 'Depot');
-            if (!($index === false)) {
+            if (strpos($line, 'Depot') !== false) {
                 $fields = explode(' ', $line);
                 if (strcmp($this->p4Depot, $fields[1]) === 0) {
                     $this->p4DepotType = $fields[3];