Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
],
"require": {
"php": "^8.2",
"dragon-code/simple-dto": "^2.3",
"dragon-code/support": "^6.0"
},
"require-dev": {
Expand Down
23 changes: 23 additions & 0 deletions src/Data/RGB.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

namespace DragonCode\WhichColor\Data;

class RGB
{
public function __construct(
public int $red = 0,
public int $green = 0,
public int $blue = 0,
) {}

public function toArray(): array
{
return [
$this->red,
$this->green,
$this->blue,
];
}
}
25 changes: 0 additions & 25 deletions src/Dto/RGB.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Helpers/Weight.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace DragonCode\WhichColor\Helpers;

use DragonCode\WhichColor\Dto\RGB;
use DragonCode\WhichColor\Data\RGB;

class Weight
{
Expand Down
2 changes: 1 addition & 1 deletion src/Services/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace DragonCode\WhichColor\Services;

use DragonCode\WhichColor\Dto\RGB;
use DragonCode\WhichColor\Data\RGB;
use DragonCode\WhichColor\Helpers\Weight;

class Color
Expand Down
4 changes: 2 additions & 2 deletions src/Services/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use DragonCode\Support\Facades\Helpers\Arr;
use DragonCode\Support\Facades\Helpers\Str;
use DragonCode\Support\Facades\Instances\Instance;
use DragonCode\WhichColor\Dto\RGB;
use DragonCode\WhichColor\Data\RGB;
use ReflectionException;

class Converter
Expand All @@ -27,7 +27,7 @@ public function hex2rgb(array|RGB|string|null $hex = '#000000'): RGB

[$red, $green, $blue] = $this->parseArray($hex);

return RGB::make(compact('red', 'green', 'blue'));
return new RGB($red, $green, $blue);
}

/**
Expand Down