Skip to content

Commit c206b0d

Browse files
committed
Fixes "Usage of a function in loops should be avoided" errors.
1 parent 2f84aa3 commit c206b0d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tools/src/Ftp.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ public function set_file($file, $contents, $die_if_fail = false) {
7474
# Make sure the folder exists in the FTP server.
7575

7676
$dir = explode("/", dirname($file));
77+
$dir_part_count = count($dir);
7778
$path = "";
7879

79-
for ($i = 0; $i < count($dir); $i++) {
80+
for ($i = 0; $i < $dir_part_count; $i++) {
8081
$path.= $dir[$i] . '/';
8182

8283
if (!isset($this->existing_paths_cache[$path])) {

tools/src/Sftp.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ public function set_file($file, $contents) {
7474

7575
$file = $file;
7676
$dir = explode("/", dirname($file));
77+
$dir_part_count = count($dir);
7778
$path = "";
7879

79-
for ($i = 0; $i < count($dir); $i++) {
80+
for ($i = 0; $i < $dir_part_count; $i++) {
8081
$path.= $dir[$i] . '/';
8182

8283
if (!isset($this->existing_paths_cache[$path])) {

0 commit comments

Comments
 (0)