add charset enum

This commit is contained in:
Dennis Eichhorn 2020-04-05 17:08:04 +02:00
parent d5643868b6
commit 96dee76466
3 changed files with 57 additions and 0 deletions

32
System/CharsetType.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @package phpOMS\System
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace phpOMS\System;
use phpOMS\Stdlib\Base\Enum;
/**
* Charset enum.
*
* @package phpOMS\System
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
abstract class CharsetType extends Enum
{
public const ASCII = 'us-ascii';
public const ISO_8859_1 = 'iso-8859-1';
public const UTF_8 = 'utf-8';
}

View File

@ -284,6 +284,28 @@ final class File extends FileAbstract implements LocalContainerInterface, FileIn
return (int) \fileperms($path);
}
/**
* Multi-byte path info
*
* @param string $path Path
*
* @return array
*
* @since 1.0.0
*/
public static function pathInfo(string $path) : array
{
$info = [];
\preg_match('#^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^.\\\\/]+?)|))[\\\\/.]*$#m', $path, $info);
$info['dirname'] = $info[1] ?? '';
$info['basename'] = $info[2] ?? '';
$info['filename'] = $info[3] ?? '';
$info['extension'] = $info[5] ?? '';
return $info;
}
/**
* Gets the directory name of a file.
*

View File

@ -514,6 +514,9 @@ abstract class MimeType extends Enum
public const M_MSL = 'application/vnd.mobius.msl';
public const M_MSTY = 'application/vnd.muvee.style';
public const M_MULT = 'multipart/form-data';
public const M_ALT = 'multipart/alternative';
public const M_MIXED = 'multipart/mixed';
public const M_RELATED = 'multipart/related';
public const M_MTS = 'model/vnd.mts';
public const M_MUS = 'application/vnd.musician';
public const M_MUSICXML = 'application/vnd.recordare.musicxml+xml';