Skip to content

Commit

Permalink
Merge pull request #19 from ARCANEDEV/update-package
Browse files Browse the repository at this point in the history
Updating the package
  • Loading branch information
arcanedev-maroc authored Oct 2, 2019
2 parents dc11523 + 21ed43e commit c69d501
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 60 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/Breadcrumbs/r

* Well tested with maximum code quality.
* Easy setup & configuration.
* Laravel `5.0` to ` 6.0` are supported.
* Laravel `5.0` to ` 6.x` are supported.
* Twitter Bootstrap `v3 | v4` are supported.
* ZURB Foundation `v5 | v6` are supported.
* Well documented & IDE Friendly.
Expand All @@ -45,7 +45,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.
- [ARCANEDEV][link-author]
- [All Contributors][link-contributors]

[badge_laravel]: https://img.shields.io/badge/Laravel%20supported-5.0%20to%206.0-orange.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel%20supported-5.0%20to%206.x-orange.svg?style=flat-square
[badge_license]: https://img.shields.io/packagist/l/arcanedev/breadcrumbs.svg?style=flat-square
[badge_build]: https://img.shields.io/travis/ARCANEDEV/Breadcrumbs.svg?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/Breadcrumbs.svg?style=flat-square
Expand Down
2 changes: 1 addition & 1 deletion _docs/0-Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ A simple breadcrumbs generator helper.

* Well tested with maximum code quality.
* Easy setup & configuration.
* Laravel `5.0` to ` 6.0` are supported.
* Laravel `5.0` to ` 6.x` are supported.
* Twitter Bootstrap `v3 | v4` are supported.
* ZURB Foundation `v5 | v6` are supported.
* Well documented & IDE Friendly.
Expand Down
20 changes: 10 additions & 10 deletions _docs/1-Installation-and-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
| ![Breadcrumbs v3.2.x][breadcrumbs_3_2_x] | ![Laravel v5.6][laravel_5_6] |
| ![Breadcrumbs v3.3.x][breadcrumbs_3_3_x] | ![Laravel v5.7][laravel_5_7] |
| ![Breadcrumbs v3.4.x][breadcrumbs_3_4_x] | ![Laravel v5.8][laravel_5_8] |
| ![Breadcrumbs v4.0.x][breadcrumbs_4_0_x] | ![Laravel v6.0][laravel_6_0] |
| ![Breadcrumbs v4.x][breadcrumbs_4_x] | ![Laravel v6.x][laravel_6_x] |

[laravel_5_0]: https://img.shields.io/badge/v5.0-supported-brightgreen.svg?style=flat-square "Laravel v5.0"
[laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1"
Expand All @@ -27,15 +27,15 @@
[laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6"
[laravel_5_7]: https://img.shields.io/badge/v5.7-supported-brightgreen.svg?style=flat-square "Laravel v5.7"
[laravel_5_8]: https://img.shields.io/badge/v5.8-supported-brightgreen.svg?style=flat-square "Laravel v5.8"
[laravel_6_0]: https://img.shields.io/badge/v6.0-supported-brightgreen.svg?style=flat-square "Laravel v6.0"

[breadcrumbs_2_x]: https://img.shields.io/badge/version-2.*-blue.svg?style=flat-square "Breadcrumbs v2.*"
[breadcrumbs_3_0_x]: https://img.shields.io/badge/version-3.0.*-blue.svg?style=flat-square "Breadcrumbs v3.0.*"
[breadcrumbs_3_1_x]: https://img.shields.io/badge/version-3.1.*-blue.svg?style=flat-square "Breadcrumbs v3.1.*"
[breadcrumbs_3_2_x]: https://img.shields.io/badge/version-3.2.*-blue.svg?style=flat-square "Breadcrumbs v3.2.*"
[breadcrumbs_3_3_x]: https://img.shields.io/badge/version-3.3.*-blue.svg?style=flat-square "Breadcrumbs v3.3.*"
[breadcrumbs_3_4_x]: https://img.shields.io/badge/version-3.4.*-blue.svg?style=flat-square "Breadcrumbs v3.4.*"
[breadcrumbs_4_0_x]: https://img.shields.io/badge/version-4.0.*-blue.svg?style=flat-square "Breadcrumbs v4.0.*"
[laravel_6_x]: https://img.shields.io/badge/v6.x-supported-brightgreen.svg?style=flat-square "Laravel v6.x"

[breadcrumbs_2_x]: https://img.shields.io/badge/version-2.x-blue.svg?style=flat-square "Breadcrumbs v2.x"
[breadcrumbs_3_0_x]: https://img.shields.io/badge/version-3.0.x-blue.svg?style=flat-square "Breadcrumbs v3.0.x"
[breadcrumbs_3_1_x]: https://img.shields.io/badge/version-3.1.x-blue.svg?style=flat-square "Breadcrumbs v3.1.x"
[breadcrumbs_3_2_x]: https://img.shields.io/badge/version-3.2.x-blue.svg?style=flat-square "Breadcrumbs v3.2.x"
[breadcrumbs_3_3_x]: https://img.shields.io/badge/version-3.3.x-blue.svg?style=flat-square "Breadcrumbs v3.3.x"
[breadcrumbs_3_4_x]: https://img.shields.io/badge/version-3.4.x-blue.svg?style=flat-square "Breadcrumbs v3.4.x"
[breadcrumbs_4_x]: https://img.shields.io/badge/version-4.x-blue.svg?style=flat-square "Breadcrumbs v4.x"

## Composer

Expand Down
36 changes: 35 additions & 1 deletion _docs/2-Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,38 @@
2. [Configuration](2-Configuration.md)
3. [Usage](3-Usage.md)

> Coming Soon...
```php
<?php

return [

/* -----------------------------------------------------------------
| Template
| -----------------------------------------------------------------
*/

'template' => [

'default' => Arcanedev\Breadcrumbs\Breadcrumbs::DEFAULT_TEMPLATE,

'supported' => [
// Twitter Bootstrap
'bootstrap-3' => 'breadcrumbs::bootstrap-3',
'bootstrap-4' => 'breadcrumbs::bootstrap-4',

// Zurb Foundation
'foundation-5' => 'breadcrumbs::foundation-5',
'foundation-6' => 'breadcrumbs::foundation-6',
],

],

/* -----------------------------------------------------------------
| Route
| -----------------------------------------------------------------
*/

'home-route' => 'public::home',

];
```
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"license": "MIT",
"require": {
"php": ">=7.2.0",
"arcanedev/support": "~5.0.0"
"arcanedev/support": "^5.0"
},
"require-dev": {
"orchestra/testbench": "~4.0.0",
"phpunit/phpcov": "~6.0",
"phpunit/phpunit": "~8.0"
"orchestra/testbench": "^4.0",
"phpunit/phpcov": "^6.0",
"phpunit/phpunit": "^8.0"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 4 additions & 2 deletions helpers.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

use Arcanedev\Breadcrumbs\Contracts\Breadcrumbs;

if ( ! function_exists('breadcrumbs')) {
/**
* Get the Breadcrumb instance.
*
* @return \Arcanedev\Breadcrumbs\Contracts\Breadcrumbs
*/
function breadcrumbs() {
return app(Arcanedev\Breadcrumbs\Contracts\Breadcrumbs::class);
function breadcrumbs(): Breadcrumbs {
return app(Breadcrumbs::class);
}
}
51 changes: 14 additions & 37 deletions src/BreadcrumbsServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php namespace Arcanedev\Breadcrumbs;

use Arcanedev\Support\PackageServiceProvider;
use Arcanedev\Support\Providers\PackageServiceProvider;
use Illuminate\Contracts\Support\DeferrableProvider;

/**
* Class BreadcrumbsServiceProvider
*
* @package Arcanedev\Breadcrumbs
* @author ARCANEDEV <[email protected]>
*/
class BreadcrumbsServiceProvider extends PackageServiceProvider
class BreadcrumbsServiceProvider extends PackageServiceProvider implements DeferrableProvider
{
/* -----------------------------------------------------------------
| Properties
Expand All @@ -22,13 +23,6 @@ class BreadcrumbsServiceProvider extends PackageServiceProvider
*/
protected $package = 'breadcrumbs';

/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;

/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
Expand All @@ -37,22 +31,26 @@ class BreadcrumbsServiceProvider extends PackageServiceProvider
/**
* Register the service provider.
*/
public function register()
public function register(): void
{
parent::register();

$this->registerConfig();
$this->registerBreadcrumbsService();

// Register the Breadcrumbs service.
$this->singleton(Contracts\Breadcrumbs::class, function ($app) {
return new Breadcrumbs(
$app['config']->get('breadcrumbs.template.supported', []),
$app['config']->get('breadcrumbs.template.default', '')
);
});
}

/**
* Boot the service provider.
*/
public function boot()
public function boot(): void
{
parent::boot();

// Publishes
$this->publishConfig();
$this->publishViews();
$this->publishTranslations();
Expand All @@ -63,31 +61,10 @@ public function boot()
*
* @return array
*/
public function provides()
public function provides(): array
{
return [
Contracts\Breadcrumbs::class,
];
}

/* -----------------------------------------------------------------
| Other Methods
| -----------------------------------------------------------------
*/

/**
* Register the Breadcrumbs service.
*/
private function registerBreadcrumbsService()
{
$this->singleton(Contracts\Breadcrumbs::class, function ($app) {
/** @var \Illuminate\Contracts\Config\Repository $config */
$config = $app['config'];

return new Breadcrumbs(
$config->get('breadcrumbs.template.supported', []),
$config->get('breadcrumbs.template.default', '')
);
});
}
}
2 changes: 1 addition & 1 deletion src/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private function checkName($name)
{
if ( ! is_string($name)) {
throw new Exceptions\InvalidTypeException(
'The name value must be a string, ' . gettype($name) . ' given'
'The name value must be a string, '.gettype($name).' given'
);
}

Expand Down
5 changes: 3 additions & 2 deletions tests/BreadcrumbsServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ public function it_can_be_instantiated()
{
$expectations = [
\Illuminate\Support\ServiceProvider::class,
\Arcanedev\Support\ServiceProvider::class,
\Arcanedev\Support\PackageServiceProvider::class,
\Illuminate\Contracts\Support\DeferrableProvider::class,
\Arcanedev\Support\Providers\ServiceProvider::class,
\Arcanedev\Support\Providers\PackageServiceProvider::class,
BreadcrumbsServiceProvider::class,
];

Expand Down

0 comments on commit c69d501

Please sign in to comment.