From 6efe1ffbc890c9a4c190d36414487ecc4a07b8b3 Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Fri, 17 Feb 2017 08:39:27 -0500 Subject: [PATCH] Slightly reorganize model hierarchy --- src/Model/API.php | 8 +++----- src/Model/AbstractModel.php | 26 ++++++++++++++++++++++++++ src/Model/DB.php | 3 +-- 3 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 src/Model/AbstractModel.php diff --git a/src/Model/API.php b/src/Model/API.php index 354761b6..6c6442ee 100644 --- a/src/Model/API.php +++ b/src/Model/API.php @@ -16,12 +16,10 @@ namespace Aviat\AnimeClient\Model; -use Aviat\Ion\Model; - /** * Base model for api interaction */ -class API extends Model { +class API extends AbstractModel { /** * Sort the list entries by their title @@ -31,13 +29,13 @@ class API extends Model { * @param string $sort_key * @return void */ - protected function sortByName(array &$array, string $sort_key) + protected function sortByName(array &$array, string $sortKey) { $sort = []; foreach ($array as $key => $item) { - $sort[$key] = $item[$sort_key]['titles'][0]; + $sort[$key] = $item[$sortKey]['titles'][0]; } array_multisort($sort, SORT_ASC, $array); diff --git a/src/Model/AbstractModel.php b/src/Model/AbstractModel.php new file mode 100644 index 00000000..c7cab2ec --- /dev/null +++ b/src/Model/AbstractModel.php @@ -0,0 +1,26 @@ + + * @copyright 2015 - 2017 Timothy J. Warren + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @version 4.0 + * @link https://github.com/timw4mail/HummingBirdAnimeClient + */ + +namespace Aviat\AnimeClient\Model; + +use Aviat\Ion\StringWrapper; + +/** + * Base class for Models + */ +abstract class AbstractModel { + use StringWrapper; +} \ No newline at end of file diff --git a/src/Model/DB.php b/src/Model/DB.php index 647076fc..a4a29167 100644 --- a/src/Model/DB.php +++ b/src/Model/DB.php @@ -17,12 +17,11 @@ namespace Aviat\AnimeClient\Model; use Aviat\Ion\Di\{ContainerAware, ContainerInterface}; -use Aviat\Ion\Model; /** * Base model for database interaction */ -class DB extends Model { +class DB extends AbstractModel { use ContainerAware; /**