From 4f13c4e5128375c9313ad8b3fc37c801541fd37b Mon Sep 17 00:00:00 2001 From: ignace nyamagana butera Date: Tue, 10 Dec 2024 20:41:56 +0100 Subject: [PATCH] Improve enclose feature method naming --- docs/9.0/writer/index.md | 2 +- src/Writer.php | 7 ++++--- src/WriterTest.php | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/9.0/writer/index.md b/docs/9.0/writer/index.md index f8b23715..a875a182 100644 --- a/docs/9.0/writer/index.md +++ b/docs/9.0/writer/index.md @@ -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 ``` diff --git a/src/Writer.php b/src/Writer.php index d6e6d2d5..984e256c 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -95,7 +95,7 @@ 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 { @@ -103,9 +103,10 @@ public function encloseNone(): bool } /** - * 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; } diff --git a/src/WriterTest.php b/src/WriterTest.php index 85104f37..f29d185f 100644 --- a/src/WriterTest.php +++ b/src/WriterTest.php @@ -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,jane.doe@example.com', $csv->toString()); } @@ -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()); } @@ -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()); } }