Skip to content

Commit

Permalink
Renamed method names #1
Browse files Browse the repository at this point in the history
  • Loading branch information
karlomikus committed Oct 31, 2015
1 parent 681169b commit fc9c3f3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All Notable changes to `karlomikus\theme` will be documented in this file

## v 1.0.1 - 2015-10-25

- Added `theme:list` artisan command
- Updated coding style to PSR2
- Added helper functions
- Renamed methods (exists -> has, getThemes -> all) [#1](https://github.com/karlomikus/theme/issues/1)

## v 1.0.0 - 2015-10-22

- First release
2 changes: 1 addition & 1 deletion src/Theme/Commands/ThemeListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(Theme $theme)
*/
public function handle()
{
$themes = $this->theme->getThemes();
$themes = $this->theme->all();
$headers = ['Name', 'Author', 'Namespace'];

$output = [];
Expand Down
6 changes: 3 additions & 3 deletions src/Theme/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct(Container $app)
*/
public function set($theme)
{
if (!$this->themeExists($theme)) {
if (!$this->has($theme)) {
throw new ThemeNotFoundException($theme);
}

Expand All @@ -77,7 +77,7 @@ public function set($theme)
*
* @return array|ThemeInfo[]
*/
public function getThemes()
public function all()
{
return $this->themes;
}
Expand All @@ -103,7 +103,7 @@ public function get($theme = null)
* @param $theme
* @return bool
*/
public function themeExists($theme)
public function has($theme)
{
return array_key_exists($theme, $this->themes);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/ThemeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public function testGetActiveTheme()

public function testGetAllThemes()
{
$this->assertArrayHasKey('test-theme', $this->theme->getThemes());
$this->assertArrayHasKey('parent-theme', $this->theme->getThemes());
$this->assertArrayHasKey('test-theme', $this->theme->all());
$this->assertArrayHasKey('parent-theme', $this->theme->all());
}

public function testSetTheme()
Expand All @@ -35,8 +35,8 @@ public function testSetTheme()

public function testThemeExists()
{
$this->assertNotTrue($this->theme->themeExists('test-false'));
$this->assertTrue($this->theme->themeExists('test-theme'));
$this->assertNotTrue($this->theme->has('test-false'));
$this->assertTrue($this->theme->has('test-theme'));
}

}

0 comments on commit fc9c3f3

Please sign in to comment.