Skip to content

Commit

Permalink
Improve enclose feature method naming
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Dec 10, 2024
1 parent fadc2e1 commit 4f13c4e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/9.0/writer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public Writer::forceEnclosure(): self
public Writer::relaxEnclosure(): self
public Writer::noEnclosure(): self
public Writer::encloseAll(): bool
public Writer::encloseRelax(): bool
public Writer::encloseSelective(): bool
public Writer::encloseNone(): bool
```

Expand Down
7 changes: 4 additions & 3 deletions src/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,18 @@ public function encloseAll(): bool
}

/**
* Tells whether new entries will all be enclosed on writing.
* Tells whether new entries will never be enclosed on writing.
*/
public function encloseNone(): bool
{
return self::ENCLOSE_NONE === $this->enclose_all;
}

/**
* Tells whether new entries will all be enclosed on writing.
* Tells whether new entries will be selectively enclosed on writing
* if the field content requires encoding.
*/
public function encloseRelax(): bool
public function encloseSelective(): bool
{
return self::ENCLOSE_RELAX === $this->enclose_all;
}
Expand Down
6 changes: 3 additions & 3 deletions src/WriterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function testInsertNormalFile(): void

self::assertFalse($csv->encloseAll());
self::assertFalse($csv->encloseNone());
self::assertTrue($csv->encloseRelax());
self::assertTrue($csv->encloseSelective());
self::assertStringContainsString('jane,doe,[email protected]', $csv->toString());
}

Expand Down Expand Up @@ -310,7 +310,7 @@ public function testEncloseAll(): void

self::assertTrue($csv->encloseAll());
self::assertFalse($csv->encloseNone());
self::assertFalse($csv->encloseRelax());
self::assertFalse($csv->encloseSelective());
self::assertStringContainsString($expected, $csv->toString());
}

Expand Down Expand Up @@ -344,7 +344,7 @@ public function testEncloseNothing(): void

self::assertFalse($csv->encloseAll());
self::assertTrue($csv->encloseNone());
self::assertFalse($csv->encloseRelax());
self::assertFalse($csv->encloseSelective());
self::assertStringContainsString($expected, $csv->toString());
}
}

0 comments on commit 4f13c4e

Please sign in to comment.