| @@ 31-38 (lines=8) @@ | ||
| 28 | return $this->value; |
|
| 29 | } |
|
| 30 | ||
| 31 | public static function newFromString(string $value) |
|
| 32 | { |
|
| 33 | $value = strtoupper($value); |
|
| 34 | if (! in_array($value, [static::LEFT, static::CENTER, static::RIGHT])) { |
|
| 35 | $value = static::LEFT; |
|
| 36 | } |
|
| 37 | return new Align($value); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| @@ 30-37 (lines=8) @@ | ||
| 27 | return $this->value; |
|
| 28 | } |
|
| 29 | ||
| 30 | public static function newFromString(string $value) |
|
| 31 | { |
|
| 32 | $value = strtoupper($value); |
|
| 33 | if (! in_array($value, [static::LANDSCAPE, static::PORTRAIT])) { |
|
| 34 | $value = static::LANDSCAPE; |
|
| 35 | } |
|
| 36 | return new Orientation($value); |
|
| 37 | } |
|
| 38 | } |
|
| 39 | ||
| @@ 45-52 (lines=8) @@ | ||
| 42 | $this->color = $color; |
|
| 43 | } |
|
| 44 | ||
| 45 | public static function newFromString($value, Color $color) |
|
| 46 | { |
|
| 47 | $value = strtoupper($value); |
|
| 48 | if (! in_array($value, [static::NONE, static::FIT, static::BOX])) { |
|
| 49 | $value = static::BOX; |
|
| 50 | } |
|
| 51 | return new static($value, $color); |
|
| 52 | } |
|
| 53 | } |
|
| 54 | ||