Skip to content

This library provides a value object which ensures a trimmed non empty string.

License

Notifications You must be signed in to change notification settings

OskarStark/trimmed-non-empty-string

Repository files navigation

trimmed-non-empty-string

This library provides a value object which ensures a trimmed non empty string.

CI

Installation

composer require oskarstark/trimmed-non-empty-string

Usage

<?php

declare(strict_types=1);

namespace App\Domain\Value\Name;

use OskarStark\Value\TrimmedNonEmptyString;

final class Name
{
    private string $value;

    private function __construct(string $value)
    {
        $this->value = TrimmedNonEmptyString::fromString($value)->toString();
    }

    public static function fromString(string $value): self
    {
        return new self($value);
    }

    public function toString(): string
    {
        return $this->value;
    }
}

About

This library provides a value object which ensures a trimmed non empty string.

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •