Skip to content

Commit

Permalink
Merge pull request #38 from johnkrovitch/feature/add-typed-method
Browse files Browse the repository at this point in the history
Add type method to retrieve configuration values
  • Loading branch information
johnkrovitch authored Nov 10, 2020
2 parents d1a6c0c + 3ca1dad commit 9337891
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,19 @@ public function isFrozen(): bool
{
return isset($this->values);
}

public function getBool(string $name): bool
{
return (bool) $this->get($name);
}

public function getInt(string $name): int
{
return (int) $this->get($name);
}

public function getString(string $name): string
{
return (string) $this->get($name);
}
}
6 changes: 6 additions & 0 deletions src/ConfigurationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@ public function has(string $name): bool;
* Return true if the configuration is frozen.
*/
public function isFrozen(): bool;

public function getBool(string $name): bool;

public function getInt(string $name): int;

public function getString(string $name): string;
}

0 comments on commit 9337891

Please sign in to comment.