From fc9c3f39be8103b443aadbe1dbe9712f9d808b7a Mon Sep 17 00:00:00 2001 From: karlomikus Date: Sat, 31 Oct 2015 14:41:08 +0100 Subject: [PATCH] Renamed method names #1 --- CHANGELOG.md | 7 +++++++ src/Theme/Commands/ThemeListCommand.php | 2 +- src/Theme/Theme.php | 6 +++--- tests/ThemeTest.php | 8 ++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c2287e..9023c27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 \ No newline at end of file diff --git a/src/Theme/Commands/ThemeListCommand.php b/src/Theme/Commands/ThemeListCommand.php index fbabe20..b2c0847 100644 --- a/src/Theme/Commands/ThemeListCommand.php +++ b/src/Theme/Commands/ThemeListCommand.php @@ -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 = []; diff --git a/src/Theme/Theme.php b/src/Theme/Theme.php index 91eaeb3..919bb93 100644 --- a/src/Theme/Theme.php +++ b/src/Theme/Theme.php @@ -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); } @@ -77,7 +77,7 @@ public function set($theme) * * @return array|ThemeInfo[] */ - public function getThemes() + public function all() { return $this->themes; } @@ -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); } diff --git a/tests/ThemeTest.php b/tests/ThemeTest.php index ed8c55d..01bf6aa 100644 --- a/tests/ThemeTest.php +++ b/tests/ThemeTest.php @@ -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() @@ -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')); } }