Skip to content

Commit 263aab1

Browse files
committed
Php fixer
1 parent 8e96892 commit 263aab1

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

message.txt

-5
This file was deleted.

src/FileInfo.php

+16-11
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,46 @@
11
<?php
2+
23
namespace Trihydera\File;
34

45
/**
56
* Class FileInfo
6-
*
7+
*
78
* Retrieves information about files in a directory, including file details like size, hash, and modification time.
89
*/
9-
class FileInfo {
10+
class FileInfo
11+
{
1012
private $dir;
1113

1214
/**
1315
* FileInfo constructor.
14-
*
16+
*
1517
* @param string $dir The directory path to retrieve file information from.
1618
*/
17-
public function __construct($dir) {
19+
public function __construct($dir)
20+
{
1821
$this->dir = $dir;
1922
}
2023

2124
/**
2225
* Get information about files in the directory.
23-
*
26+
*
2427
* @return array An array containing details of files in the directory.
2528
*/
26-
public function getInfo() {
29+
public function getInfo()
30+
{
2731
$details = [];
2832
$this->listFilesRecursively($this->dir, $details);
2933
return $details;
3034
}
3135

3236
/**
3337
* Recursively list files in a directory and gather details.
34-
*
38+
*
3539
* @param string $dir The directory path to list files from.
3640
* @param array $details Reference to an array to store file details.
3741
*/
38-
private function listFilesRecursively($dir, &$details) {
42+
private function listFilesRecursively($dir, &$details)
43+
{
3944
$files = scandir($dir);
4045

4146
foreach ($files as $file) {
@@ -69,14 +74,14 @@ private function listFilesRecursively($dir, &$details) {
6974

7075
/**
7176
* Format file size in human-readable format.
72-
*
77+
*
7378
* @param int $bytes The size of the file in bytes.
7479
* @return string The formatted file size with appropriate units.
7580
*/
76-
private function formatSize($bytes) {
81+
private function formatSize($bytes)
82+
{
7783
$units = array('B', 'KB', 'MB', 'GB', 'TB');
7884
$i = floor(log($bytes, 1024));
7985
return @round($bytes / pow(1024, $i), 2) . ' ' . $units[$i];
8086
}
8187
}
82-
?>

src/FileTypes.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<?php
2+
23
namespace Trihydera\File;
34

45
/**
56
* Class FileTypes
6-
*
7+
*
78
* Defines different file types along with their categories and purposes.
89
*/
9-
class FileTypes {
10+
class FileTypes
11+
{
1012
/**
1113
* Array containing file types with their categories and purposes.
12-
*
14+
*
1315
* @var array
1416
*/
1517
public $types = [
@@ -25,4 +27,3 @@ class FileTypes {
2527
'mp3' => ['category' => 'Audio', 'purpose' => 'MP3 Audio File']
2628
];
2729
}
28-
?>

src/JsonFile.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<?php
2+
23
namespace Trihydera\File;
34

45
/**
56
* Class JsonFile
6-
*
7+
*
78
* Handles reading and writing JSON data to files.
89
*/
910
class JsonFile
1011
{
1112
/**
1213
* Read JSON data from a file.
13-
*
14+
*
1415
* @param string $file The path to the JSON file.
1516
* @return array The decoded JSON data.
1617
* @throws \Exception If the file path is invalid.
@@ -23,7 +24,7 @@ public function read($file)
2324

2425
/**
2526
* Write JSON data to a file.
26-
*
27+
*
2728
* @param string $file The path to the JSON file.
2829
* @param array $data The data to be encoded as JSON and written to the file.
2930
* @throws \Exception If the file path is invalid.
@@ -33,4 +34,3 @@ public function write($file, $data)
3334
file_put_contents($file, json_encode($data));
3435
}
3536
}
36-
?>

0 commit comments

Comments
 (0)