eee
This commit is contained in:
@@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Kiri\Router\Annotate;
|
|
||||||
|
|
||||||
#[\Attribute(((\Attribute::TARGET_METHOD)))]
|
|
||||||
class ContentType
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $contentType
|
|
||||||
*/
|
|
||||||
public function __construct(public string $contentType = "text/html")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Kiri\Router\Annotate;
|
||||||
|
|
||||||
|
use Kiri\Router\ContentType;
|
||||||
|
|
||||||
|
#[\Attribute(\Attribute::TARGET_METHOD)]
|
||||||
|
class ResponseContentType
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ContentType $contentType
|
||||||
|
*/
|
||||||
|
public function __construct(public ContentType $contentType = ContentType::JSON)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+3
-2
@@ -373,6 +373,7 @@ enum ContentType
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $method
|
* @param $method
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function toString(): string
|
public function toString(): string
|
||||||
@@ -496,7 +497,7 @@ enum ContentType
|
|||||||
self::PIC => 'application/x-pic',
|
self::PIC => 'application/x-pic',
|
||||||
self::PL => 'application/x-perl',
|
self::PL => 'application/x-perl',
|
||||||
self::PLT => 'application/x-plt',
|
self::PLT => 'application/x-plt',
|
||||||
self::PNG => 'application/x-png',
|
self::X_PNG => 'application/x-png',
|
||||||
self::PPA, self::PPS, self::PWZ, self::POT, self::PPT => 'application/vnd.ms-powerpoint',
|
self::PPA, self::PPS, self::PWZ, self::POT, self::PPT => 'application/vnd.ms-powerpoint',
|
||||||
self::X_PPT => 'application/x-ppt',
|
self::X_PPT => 'application/x-ppt',
|
||||||
self::PRF => 'application/pics-rules',
|
self::PRF => 'application/pics-rules',
|
||||||
@@ -641,7 +642,7 @@ enum ContentType
|
|||||||
self::ICON => 'image/x-icon',
|
self::ICON => 'image/x-icon',
|
||||||
self::JFIF, self::X_JPE, self::JPEG, self::X_JPG => 'image/jpeg',
|
self::JFIF, self::X_JPE, self::JPEG, self::X_JPG => 'image/jpeg',
|
||||||
self::NET => 'image/pnetvue',
|
self::NET => 'image/pnetvue',
|
||||||
self::X_PNG => 'image/png',
|
self::PNG => 'image/png',
|
||||||
self::RP => 'image/vnd.rn-realpix',
|
self::RP => 'image/vnd.rn-realpix',
|
||||||
self::WBMP => 'image/vnd.wap.wbmp',
|
self::WBMP => 'image/vnd.wap.wbmp',
|
||||||
self::EML, self::MHT, self::MHTML, self::NWS => 'message/rfc822',
|
self::EML, self::MHT, self::MHTML, self::NWS => 'message/rfc822',
|
||||||
|
|||||||
Reference in New Issue
Block a user