Skip to content

Commit

Permalink
Use lazy FileAttributes creation
Browse files Browse the repository at this point in the history
  • Loading branch information
kelunik committed May 10, 2018
1 parent 1758eb0 commit 277e05f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class Field {
public function __construct(string $name, string $value = "", FieldAttributes $attributes = null) {
$this->name = $name;
$this->value = $value;
$this->attributes = $attributes ?? new FieldAttributes;
$this->attributes = $attributes;
}

public function getName(): string {
Expand All @@ -31,6 +31,6 @@ public function hasValue(): bool {
}

public function getAttributes(): FieldAttributes {
return $this->attributes;
return $this->attributes ?? $this->attributes = new FieldAttributes;
}
}

0 comments on commit 277e05f

Please sign in to comment.