Create FileSystemUtil interface

This commit is contained in:
Art4 2025-04-14 07:14:31 +00:00
parent 83f561ea49
commit 65624e2c19
2 changed files with 39 additions and 1 deletions

View file

@ -12,7 +12,7 @@ use Friendica\Core\Logger\Exception\LoggerUnusableException;
/** /**
* Util class for filesystem manipulation for Logger classes * Util class for filesystem manipulation for Logger classes
*/ */
class FileSystem class FileSystem implements FileSystemUtil
{ {
/** /**
* @var string a error message * @var string a error message

View file

@ -0,0 +1,38 @@
<?php
// Copyright (C) 2010-2024, the Friendica project
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
//
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Core\Logger\Util;
use Friendica\Core\Logger\Exception\LoggerUnusableException;
/**
* interface for Util class for filesystem manipulation for Logger classes
*/
interface FileSystemUtil
{
/**
* Creates a directory based on a file, which gets accessed
*
* @param string $file The file
*
* @return string The directory name (empty if no directory is found, like urls)
*
* @throws LoggerUnusableException
*/
public function createDir(string $file): string;
/**
* Creates a stream based on a URL (could be a local file or a real URL)
*
* @param string $url The file/url
*
* @return resource the open stream resource
*
* @throws LoggerUnusableException
*/
public function createStream(string $url);
}