Skip to content

Commit

Permalink
Upgrades for L5
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiandedeyne committed Apr 22, 2016
1 parent 1fc8de9 commit b221711
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 43 deletions.
29 changes: 14 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
{
"name": "spatie/checkout",
"description": "A simple e-commerce checkout helper for Laravel 4",
"description": "A simple e-commerce checkout helper for Laravel 5",
"homepage": "https://github.com/spatie/checkout",
"keywords":
[
"webshop",
"checkout",
"laravel",
"payment",
"gateway",
"helper",
"laravel"
],
"keywords": [
"webshop",
"checkout",
"laravel",
"payment",
"gateway",
"helper",
"laravel"
],
"license": "MIT",
"authors": [
{
Expand All @@ -20,9 +19,9 @@
}
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "~4.2|~5.0.0|~5.1.0|~5.2.0",
"illuminate/session": "~4.2|~5.0.0|~5.1.0|~5.2.0"
"php": "^5.6.0|^7.0",
"illuminate/support": "~5.1.0|~5.2.0",
"illuminate/session": "~5.1.0|~5.2.0"
},
"autoload": {
"psr-4": {
Expand All @@ -31,6 +30,6 @@
},
"minimum-stability": "stable",
"require-dev": {
"phpspec/phpspec": "2.0.*"
"phpspec/phpspec": "^2.0"
}
}
25 changes: 13 additions & 12 deletions src/Checkout.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php namespace Spatie\Checkout;
<?php

use Illuminate\Session\Store;
namespace Spatie\Checkout;

class Checkout {
use Illuminate\Session\Store;

class Checkout
{
private $sessionVariableName = 'spatie.checkout.currentOrderId';

/**
Expand All @@ -14,13 +16,13 @@ class Checkout {
/**
* @param Store $session
*/
function __construct(Store $session)
public function __construct(Store $session)
{
$this->session = $session;
}

/**
* Set the current order id
* Set the current order id.
*
* @param $orderId
*/
Expand All @@ -30,7 +32,7 @@ public function setCurrentOrderId($orderId)
}

/**
* Get the current order id
* Get the current order id.
*
* @return mixed
*/
Expand All @@ -40,23 +42,22 @@ public function getCurrentOrderId()
}

/**
* Clear the current order id
*
* Clear the current order id.
*/
public function clearCurrentOrderId()
{
$this->session->forget($this->sessionVariableName);
}

/**
* Check if the given order id is the current order id
* Check if the given order id is the current order id.
*
* @param $orderId
*
* @return bool
*/
public function isCurrentOrderId($orderId)
{
return ($this->getCurrentOrderId() == $orderId);
return $this->getCurrentOrderId() == $orderId;
}

}
}
13 changes: 7 additions & 6 deletions src/CheckoutFacade.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?php namespace Spatie\Checkout;
<?php

use Illuminate\Support\Facades\Facade;
namespace Spatie\Checkout;

class CheckoutFacade extends Facade {
use Illuminate\Support\Facades\Facade;

class CheckoutFacade extends Facade
{
/**
* Get the binding in the IoC container
* @see \Spatie\Checkout\Checkout
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'checkout';
}

}
}
19 changes: 9 additions & 10 deletions src/CheckoutServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<?php namespace Spatie\Checkout;
<?php

use Illuminate\Support\ServiceProvider;
namespace Spatie\Checkout;

class CheckoutServiceProvider extends ServiceProvider {
use Illuminate\Support\ServiceProvider;

/**
* Create binding
*/
class CheckoutServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->bindShared('checkout', function()
{
$this->app->singleton(Checkout::class, function () {
return $this->app->make('Spatie\Checkout\Checkout');
});
}

}
$this->app->alias(Checkout::class);
}
}

0 comments on commit b221711

Please sign in to comment.