Skip to content

Commit 439c9f0

Browse files
use is_file over file_exists
1 parent 09be2f5 commit 439c9f0

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

src/class-endpoint-installer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function install(): bool
9090
// TODO: Verify contents? Or trust 200 OK response?
9191
9292
/* Attempt to put the file into place if it does not exist already */
93-
if (! file_exists($file_name)) {
93+
if (! is_file($file_name)) {
9494
$success = file_put_contents($file_name, $this->get_file_contents());
9595
if (false === $success) {
9696
return false;

src/collect-functions.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,7 @@ function collect_request()
9696
return;
9797
}
9898

99-
if (isset($_GET['e'])) {
100-
$data = extract_event_data($_GET);
101-
} else {
102-
$data = extract_pageview_data($_GET);
103-
}
104-
99+
$data = isset($_GET['e']) ? extract_event_data($_GET) : extract_pageview_data($_GET);
105100
if (!empty($data)) {
106101
$success = isset($_GET['test']) ? test_collect_in_file() : collect_in_file($data);
107102

src/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function using_custom_endpoint(): bool
146146
}
147147

148148
/** @see Endpoint_Installer::get_file_name() */
149-
return \file_exists(\rtrim(ABSPATH, '/') . '/koko-analytics-collect.php') && (bool) get_option('koko_analytics_use_custom_endpoint', false);
149+
return \is_file(\rtrim(ABSPATH, '/') . '/koko-analytics-collect.php') && (bool) get_option('koko_analytics_use_custom_endpoint', false);
150150
}
151151

152152
function create_local_datetime(string $timestr): \DateTimeImmutable

0 commit comments

Comments
 (0)