Files
michaelschiemer/src/Framework/Filesystem/File.php
Michael Schiemer fc3d7e6357 feat(Production): Complete production deployment infrastructure
- Add comprehensive health check system with multiple endpoints
- Add Prometheus metrics endpoint
- Add production logging configurations (5 strategies)
- Add complete deployment documentation suite:
  * QUICKSTART.md - 30-minute deployment guide
  * DEPLOYMENT_CHECKLIST.md - Printable verification checklist
  * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle
  * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference
  * production-logging.md - Logging configuration guide
  * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation
  * README.md - Navigation hub
  * DEPLOYMENT_SUMMARY.md - Executive summary
- Add deployment scripts and automation
- Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment
- Update README with production-ready features

All production infrastructure is now complete and ready for deployment.
2025-10-25 19:18:37 +02:00

113 lines
2.5 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Framework\Filesystem;
use App\Framework\Core\ValueObjects\Byte;
use App\Framework\Core\ValueObjects\Timestamp;
use App\Framework\Filesystem\ValueObjects\FileMetadata;
use App\Framework\Filesystem\ValueObjects\FilePath;
/**
* Clean File value object representing a file path with metadata.
* File operations are handled by FileSystemService for better separation of concerns.
*/
final readonly class File
{
public function __construct(
public FilePath $path,
public FileMetadata $metadata
) {
}
/**
* Create File from SplFileInfo
*/
public static function fromSplFileInfo(\SplFileInfo $fileInfo): self
{
$path = FilePath::create($fileInfo->getPathname());
$metadata = new FileMetadata(
size: $fileInfo->getSize() ?: 0,
lastModified: $fileInfo->getMTime() ?: 0,
mimeType: 'application/octet-stream', // Default, can be determined by FileSystemService
isReadable: $fileInfo->isReadable(),
isWritable: $fileInfo->isWritable()
);
return new self($path, $metadata);
}
/**
* Get path as FilePath object
*/
public function getPath(): FilePath
{
return $this->path;
}
/**
* Get path as string
*/
public function getPathString(): string
{
return $this->path->toString();
}
/**
* Get file metadata
*/
public function getMetadata(): FileMetadata
{
return $this->metadata;
}
/**
* Get modification time as Timestamp
*/
public function getModificationTime(): Timestamp
{
return Timestamp::fromFloat($this->metadata->lastModified);
}
/**
* Get file size as Byte object
*/
public function getSize(): Byte
{
return Byte::fromBytes($this->metadata->size);
}
/**
* Get filename from path
*/
public function getFilename(): string
{
return $this->path->getFilename();
}
/**
* Get file extension
*/
public function getExtension(): string
{
return $this->path->getExtension();
}
/**
* Get directory path
*/
public function getDirectory(): FilePath
{
return $this->path->getDirectory();
}
/**
* Check if file has specific extension
*/
public function hasExtension(string $extension): bool
{
return $this->path->hasExtension($extension);
}
}