Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the package #29

Merged
merged 4 commits into from
Oct 2, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updating the service provider
  • Loading branch information
arcanedev-maroc committed Oct 2, 2019
commit be0c7663de8bf7c6fe10e243d9a53bf3ffd1c023
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This package is inspired/based on [illuminate/html](https://github.com/illuminat
* Easy setup & configuration.
* Well documented & IDE Friendly.
* Well tested with maximum code quality.
* Laravel `5.1` to `6.0` are supported.
* Laravel `5.1` to `6.x` are supported.
* Made with :heart: & :coffee:.

## Table of contents
Expand All @@ -46,7 +46,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.
- [LaravelCollective](https://github.com/LaravelCollective/html)
- [All Contributors][link-contributors]

[badge_laravel]: https://img.shields.io/badge/Laravel-5.1%20to%206.0-orange.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-5.1%20to%206.x-orange.svg?style=flat-square
[badge_license]: https://img.shields.io/packagist/l/arcanedev/laravel-html.svg?style=flat-square
[badge_build]: https://img.shields.io/travis/ARCANEDEV/LaravelHtml.svg?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/LaravelHtml.svg?style=flat-square
Expand Down
48 changes: 7 additions & 41 deletions src/HtmlServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,16 @@
<?php namespace Arcanedev\LaravelHtml;

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

/**
* Class HtmlServiceProvider
*
* @package Arcanedev\LaravelHtml
* @author ARCANEDEV <[email protected]>
*/
class HtmlServiceProvider extends ServiceProvider
class HtmlServiceProvider extends ServiceProvider implements DeferrableProvider
{
/* -----------------------------------------------------------------
| Properties
| -----------------------------------------------------------------
*/

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

/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
Expand All @@ -30,47 +19,24 @@ class HtmlServiceProvider extends ServiceProvider
/**
* Register the service provider.
*/
public function register()
public function register(): void
{
parent::register();

$this->registerHtmlBuilder();
$this->registerFormBuilder();
$this->singleton(Contracts\HtmlBuilder::class, HtmlBuilder::class);
$this->singleton(Contracts\FormBuilder::class, FormBuilder::class);
}

/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
public function provides(): array
{
return [
HtmlBuilder::class,
Contracts\HtmlBuilder::class,
FormBuilder::class,
Contracts\FormBuilder::class,
];
}

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

/**
* Register the HTML builder.
*/
protected function registerHtmlBuilder()
{
$this->singleton(Contracts\HtmlBuilder::class, HtmlBuilder::class);
}

/**
* Register the form builder.
*/
protected function registerFormBuilder()
{
$this->singleton(Contracts\FormBuilder::class, FormBuilder::class);
}
}
4 changes: 1 addition & 3 deletions tests/HtmlServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function it_can_be_instantiated()
{
$expectations = [
\Illuminate\Support\ServiceProvider::class,
\Arcanedev\Support\ServiceProvider::class,
\Arcanedev\Support\Providers\ServiceProvider::class,
HtmlServiceProvider::class,
];

Expand All @@ -62,9 +62,7 @@ public function it_can_be_instantiated()
public function it_can_get_provides()
{
$expected = [
\Arcanedev\LaravelHtml\HtmlBuilder::class,
\Arcanedev\LaravelHtml\Contracts\HtmlBuilder::class,
\Arcanedev\LaravelHtml\FormBuilder::class,
\Arcanedev\LaravelHtml\Contracts\FormBuilder::class,
];

Expand Down