1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-29 00:29:55 +02:00

Add doc block documentation

This commit is contained in:
Oliver Vogel
2024-03-02 11:36:01 +01:00
parent 17ff3337dd
commit f1589875a9
5 changed files with 79 additions and 0 deletions

View File

@@ -17,6 +17,15 @@ use Intervention\Image\Interfaces\ColorspaceInterface;
class Color extends AbstractColor class Color extends AbstractColor
{ {
/**
* Create new instance
*
* @param int $c
* @param int $m
* @param int $y
* @param int $k
* @return void
*/
public function __construct(int $c, int $m, int $y, int $k) public function __construct(int $c, int $m, int $y, int $k)
{ {
/** @throws void */ /** @throws void */
@@ -28,6 +37,11 @@ class Color extends AbstractColor
]; ];
} }
/**
* {@inheritdoc}
*
* @see ColorInterface::create()
*/
public static function create(mixed $input): ColorInterface public static function create(mixed $input): ColorInterface
{ {
return (new class ([ return (new class ([
@@ -37,40 +51,75 @@ class Color extends AbstractColor
})->handle($input); })->handle($input);
} }
/**
* {@inheritdoc}
*
* @see ColorInterface::colorspace()
*/
public function colorspace(): ColorspaceInterface public function colorspace(): ColorspaceInterface
{ {
return new Colorspace(); return new Colorspace();
} }
/**
* {@inheritdoc}
*
* @see ColorInterface::toHex()
*/
public function toHex(string $prefix = ''): string public function toHex(string $prefix = ''): string
{ {
return $this->convertTo(RgbColorspace::class)->toHex($prefix); return $this->convertTo(RgbColorspace::class)->toHex($prefix);
} }
/**
* Return the CMYK cyan channel
*
* @return ColorChannelInterface
*/
public function cyan(): ColorChannelInterface public function cyan(): ColorChannelInterface
{ {
/** @throws void */ /** @throws void */
return $this->channel(Cyan::class); return $this->channel(Cyan::class);
} }
/**
* Return the CMYK magenta channel
*
* @return ColorChannelInterface
*/
public function magenta(): ColorChannelInterface public function magenta(): ColorChannelInterface
{ {
/** @throws void */ /** @throws void */
return $this->channel(Magenta::class); return $this->channel(Magenta::class);
} }
/**
* Return the CMYK yellow channel
*
* @return ColorChannelInterface
*/
public function yellow(): ColorChannelInterface public function yellow(): ColorChannelInterface
{ {
/** @throws void */ /** @throws void */
return $this->channel(Yellow::class); return $this->channel(Yellow::class);
} }
/**
* Return the CMYK key channel
*
* @return ColorChannelInterface
*/
public function key(): ColorChannelInterface public function key(): ColorChannelInterface
{ {
/** @throws void */ /** @throws void */
return $this->channel(Key::class); return $this->channel(Key::class);
} }
/**
* {@inheritdoc}
*
* @see ColorInterface::toString()
*/
public function toString(): string public function toString(): string
{ {
return sprintf( return sprintf(
@@ -82,6 +131,11 @@ class Color extends AbstractColor
); );
} }
/**
* {@inheritdoc}
*
* @see ColorInterface::isGreyscale()
*/
public function isGreyscale(): bool public function isGreyscale(): bool
{ {
return 0 === array_sum([ return 0 === array_sum([
@@ -91,6 +145,11 @@ class Color extends AbstractColor
]); ]);
} }
/**
* {@inheritdoc}
*
* @see ColorInterface::isTransparent()
*/
public function isTransparent(): bool public function isTransparent(): bool
{ {
return false; return false;

View File

@@ -26,6 +26,11 @@ class Color extends AbstractColor
]; ];
} }
/**
* {@inheritdoc}
*
* @see ColorInterface::colorspace()
*/
public function colorspace(): ColorspaceInterface public function colorspace(): ColorspaceInterface
{ {
return new Colorspace(); return new Colorspace();

View File

@@ -26,6 +26,11 @@ class Color extends AbstractColor
]; ];
} }
/**
* {@inheritdoc}
*
* @see ColorInterface::colorspace()
*/
public function colorspace(): ColorspaceInterface public function colorspace(): ColorspaceInterface
{ {
return new Colorspace(); return new Colorspace();

View File

@@ -6,6 +6,11 @@ namespace Intervention\Image\Colors\Rgb\Channels;
class Alpha extends Red class Alpha extends Red
{ {
/**
* {@inheritdoc}
*
* @see ColorChannelInterface::toString()
*/
public function toString(): string public function toString(): string
{ {
return strval(round($this->normalize(), 6)); return strval(round($this->normalize(), 6));

View File

@@ -36,6 +36,11 @@ class Color extends AbstractColor
]; ];
} }
/**
* {@inheritdoc}
*
* @see ColorInterface::colorspace()
*/
public function colorspace(): ColorspaceInterface public function colorspace(): ColorspaceInterface
{ {
return new Colorspace(); return new Colorspace();