setRed($this->decodeColorValue($this->getNextByteOrFail())); $color->setGreen($this->decodeColorValue($this->getNextByteOrFail())); $color->setBlue($this->decodeColorValue($this->getNextByteOrFail())); return $color; } /** * Decode red value from source * * @return int */ protected function decodeColorValue(string $byte): int { return unpack('C', $byte)[1]; } }