phpexpertsinc/ColorSpeaker

View on GitHub
src/internal/ColorSpeakerContract.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
<?php declare(strict_types=1);

/**
 * This file is part of ColorSpeaker, a PHP Experts, Inc., Project.
 *
 * Copyright © 2019 PHP Experts, Inc.
 * Author: Theodore R. Smith <theodore@phpexperts.pro>
 *   GPG Fingerprint: 4BF8 2613 1C34 87AC D28F  2AD8 EB24 A91D D612 5690
 *   https://www.phpexperts.pro/
 *   https://github.com/PHPExpertsInc/RGBSpeaker
 *
 * This file is licensed under the MIT License.
 *
 * It is inspired by https://stitcher.io/blog/tests-and-types
 *                   http://archive.is/99WyU
 */

namespace PHPExperts\ColorSpeaker\internal;

use PHPExperts\ColorSpeaker\DTOs\CSSHexColor;
use PHPExperts\ColorSpeaker\DTOs\HSLColor;
use PHPExperts\ColorSpeaker\DTOs\RGBColor;

/** @internal */
interface ColorSpeakerContract
{
    public static function fromRGB(int $red, int $green, int $blue): self;
    public static function fromHexCode(string $hexColor): self;

    /**
     * @param int          $hue
     * @param float|string $saturation Either float or "55.5%"
     * @param float|string $lightness  Either float or "55.5%"
     * @return static
     */
    public static function fromHSL(int $hue, $saturation, $lightness): self;

    public function __toString(): string;

    public function toRGB(): RGBColor;
    public function toHexCode(): CSSHexColor;
    public function toHSL(): HSLColor;
}