Skip to content

Commit

Permalink
adjusted function for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jamielsharief committed Oct 16, 2019
1 parent 80c0e0a commit 3d5aa45
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,14 @@ public static function uuid(array $options = []) : string
*/
public static function macAddress() : ?string
{
$macAddress = null;
if (strtoupper(php_uname('s')) === 'LINUX') {
$files = glob('/sys/class/net/*/address', GLOB_NOSORT);
foreach ($files as $file) {
$macAddress = trim(file_get_contents($file));
if ($macAddress !== '00:00:00:00:00:00' and preg_match('/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/', $macAddress)) {
return $macAddress;
$contents = trim(file_get_contents($file));
if ($contents !== '00:00:00:00:00:00' and preg_match('/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/', $contents)) {
$macAddress = $contents;
break;
}
}
}
Expand Down

0 comments on commit 3d5aa45

Please sign in to comment.