From 998174f5d0585a40b119fdd9ff9ed74a6209fb53 Mon Sep 17 00:00:00 2001 From: Carsten Jonstrup Date: Thu, 21 Sep 2017 22:58:08 +0200 Subject: [PATCH] psr-4 --- composer.json | 14 +++++++++++-- src/Lenius/Basket/BasketServiceProvider.php | 10 ++++----- .../Basket/{Facade.php => Facades/Basket.php} | 4 ++-- src/Lenius/Basket/Storage/LaravelSession.php | 21 +++++++++++-------- 4 files changed, 31 insertions(+), 18 deletions(-) rename src/Lenius/Basket/{Facade.php => Facades/Basket.php} (87%) diff --git a/composer.json b/composer.json index bcba8d1..c26e088 100644 --- a/composer.json +++ b/composer.json @@ -17,8 +17,18 @@ "phpunit/phpunit": "~6.0" }, "autoload": { - "psr-0": { - "Lenius": "src/" + "psr-4": { + "Lenius\\Basket\\": "src/" + } + }, + "extra": { + "laravel": { + "providers": [ + "Lenius\\Basket\\BasketServiceProvider" + ], + "aliases": { + "Basket": "Lenius\\Basket\\Facades\\Basket" + } } } } diff --git a/src/Lenius/Basket/BasketServiceProvider.php b/src/Lenius/Basket/BasketServiceProvider.php index 4b07707..1f13595 100644 --- a/src/Lenius/Basket/BasketServiceProvider.php +++ b/src/Lenius/Basket/BasketServiceProvider.php @@ -35,10 +35,10 @@ public function register() }); // Shortcut so developers don't need to add an Alias in app/config/app.php - $this->app->booting(function() - { - $loader = AliasLoader::getInstance(); - $loader->alias('Basket', 'Lenius\Basket\Facade'); - }); + //$this->app->booting(function() + //{ + // $loader = AliasLoader::getInstance(); + // $loader->alias('Basket', 'Lenius\Basket\Basket'); + //}); } } \ No newline at end of file diff --git a/src/Lenius/Basket/Facade.php b/src/Lenius/Basket/Facades/Basket.php similarity index 87% rename from src/Lenius/Basket/Facade.php rename to src/Lenius/Basket/Facades/Basket.php index a36ae65..fcd2bac 100644 --- a/src/Lenius/Basket/Facade.php +++ b/src/Lenius/Basket/Facades/Basket.php @@ -19,9 +19,9 @@ * */ -namespace Lenius\Basket; +namespace Lenius\Basket\Facades; -class Facade extends \Illuminate\Support\Facades\Facade +class Basket extends \Illuminate\Support\Facades\Facade { protected static function getFacadeAccessor() { diff --git a/src/Lenius/Basket/Storage/LaravelSession.php b/src/Lenius/Basket/Storage/LaravelSession.php index b228f6f..eb51dbe 100644 --- a/src/Lenius/Basket/Storage/LaravelSession.php +++ b/src/Lenius/Basket/Storage/LaravelSession.php @@ -21,7 +21,7 @@ namespace Lenius\Basket\Storage; use Lenius\Basket\Item; -use Session; + class LaravelSession implements \Lenius\Basket\StorageInterface { @@ -70,9 +70,10 @@ public function &data($asArray = false) /** * Check if the item exists in the cart - * - * @param mixed $id - * @return boolean + * + * @param mixed $identifier + * @return bool + * @internal param mixed $id */ public function has($identifier) { @@ -87,9 +88,10 @@ public function has($identifier) /** * Get a single cart item by id - * - * @param mixed $id The item id - * @return Item The item class + * + * @param mixed $identifier + * @return Item The item class + * @internal param mixed $id The item id */ public function item($identifier) { @@ -146,8 +148,9 @@ public function destroy() /** * Set the cart identifier - * - * @param string $identifier + * + * @param string $id + * @internal param string $identifier */ public function setIdentifier($id) {