Skip to content

Commit

Permalink
Remove unused isNotLabel method and update code to use notLabel prope…
Browse files Browse the repository at this point in the history
…rty. (#235)
  • Loading branch information
terabytesoftw committed Jan 12, 2024
1 parent fe9ec4c commit 22ff2b5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 32 deletions.
12 changes: 1 addition & 11 deletions src/Attribute/Custom/HasLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,6 @@ public function notLabel(): static
return $new;
}

/**
* Determine if the label is disabled or not.
*
* @return bool `true` if the label is disabled, `false` otherwise.
*/
public function isNotLabel(): bool
{
return $this->notLabel;
}

/**
* Render the label tag.
*
Expand All @@ -113,7 +103,7 @@ public function isNotLabel(): bool
*/
protected function renderLabelTag(string $labelFor = null): string
{
if ($this->labelContent === '' || $this->isNotLabel()) {
if ($this->labelContent === '' || $this->notLabel) {
return '';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Input/Base/AbstractInputChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private function prepareTemplate(string $tag, string $labelTag): string

private function renderEnclosedByLabel(string $tag, string $labelFor): string
{
if ($this->labelContent === '' || $this->isNotLabel()) {
if ($this->labelContent === '' || $this->notLabel) {
return $tag;
}

Expand Down
7 changes: 0 additions & 7 deletions src/Input/Contract/LabelInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ interface LabelInterface
*/
public function enclosedByLabel(bool $value): static;

/**
* Determine if the label is disabled or not.
*
* @return bool `true` if the label is disabled, `false` otherwise.
*/
public function isNotLabel(): bool;

/**
* Set the `HTML` attributes for the label.
*
Expand Down
16 changes: 3 additions & 13 deletions tests/Attribute/Custom/HasLabelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,17 @@ public function testImmutability(): void
$this->assertNotSame($instance, $instance->notLabel());
}

public function testIsNotLabel(): void
public function testNotLabel(): void
{
$instance = new class () {
use HasLabel;

public function getIsNotLabel(): bool
public function isNotLabel(): bool
{
return $this->isNotLabel();
return $this->notLabel;
}
};

$this->assertTrue($instance->notLabel()->getIsNotLabel());
$this->assertFalse($instance->getIsNotLabel());
}

public function testNotLabel(): void
{
$instance = new class () {
use HasLabel;
};

$this->assertFalse($instance->isNotLabel());
$this->assertTrue($instance->notLabel()->isNotLabel());
}
Expand Down

0 comments on commit 22ff2b5

Please sign in to comment.