Skip to content

Commit

Permalink
Merge pull request #6 from ARCANEDEV/develop
Browse files Browse the repository at this point in the history
Updating the package for Laravel 5.5
  • Loading branch information
arcanedev-maroc authored Sep 8, 2017
2 parents 32a7b45 + 7c4f50d commit 21b7eff
Show file tree
Hide file tree
Showing 14 changed files with 61 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 3
runs: 2
php_code_sniffer:
enabled: true
config:
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ language: php
sudo: false

php:
- 5.6
- 7.0
- 7.1
- nightly
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Spam Blocker is a package that allows you to block referral spammers.
* Easy setup & configuration.
* Well documented & IDE Friendly.
* Well tested with maximum code quality.
* Laravel `5.1 | 5.2 | 5.3 | 5.4` are supported.
* Laravel `5.1 | 5.2 | 5.3 | 5.4 | 5.5` are supported.
* Made with :heart: & :coffee:.

## TODOS
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-5.1%20to%205.4-orange.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-5.1%20to%205.5-orange.svg?style=flat-square
[badge_license]: https://img.shields.io/packagist/l/arcanedev/spam-blocker.svg?style=flat-square
[badge_build]: https://img.shields.io/travis/ARCANEDEV/SpamBlocker.svg?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/SpamBlocker.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 @@ -7,7 +7,7 @@ Spam Blocker is a package that allows you to block referral spammers.
* Easy setup & configuration.
* Well documented & IDE Friendly.
* Well tested with maximum code quality.
* Laravel `5.1 | 5.2 | 5.3 | 5.4` are supported.
* Laravel `5.1 | 5.2 | 5.3 | 5.4 | 5.5` are supported.
* Made with :heart: & :coffee:.

## Table of contents
Expand Down
7 changes: 6 additions & 1 deletion _docs/1.Installation-and-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
The Spam Blocker package has a few system requirements:

```
- PHP >= 5.6.4
- PHP >= 7.0
```

## Version Compatibility
Expand All @@ -20,14 +20,17 @@ The Spam Blocker package has a few system requirements:
|:-------------------------------------------|:---------------------------------------------------------------------------------------|
| ![Spam Blocker v1.2.x][spam_blocker_1_2_x] | ![Laravel v5.1][laravel_5_1] ![Laravel v5.2][laravel_5_2] ![Laravel v5.3][laravel_5_3] |
| ![Spam Blocker v1.3.x][spam_blocker_1_3_x] | ![Laravel v5.4][laravel_5_4] |
| ![Spam Blocker v1.4.x][spam_blocker_1_4_x] | ![Laravel v5.5][laravel_5_5] |

[laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1"
[laravel_5_2]: https://img.shields.io/badge/v5.2-supported-brightgreen.svg?style=flat-square "Laravel v5.2"
[laravel_5_3]: https://img.shields.io/badge/v5.3-supported-brightgreen.svg?style=flat-square "Laravel v5.3"
[laravel_5_4]: https://img.shields.io/badge/v5.4-supported-brightgreen.svg?style=flat-square "Laravel v5.4"
[laravel_5_5]: https://img.shields.io/badge/v5.5-supported-brightgreen.svg?style=flat-square "Laravel v5.5"

[spam_blocker_1_2_x]: https://img.shields.io/badge/version-1.2.*-blue.svg?style=flat-square "Spam Blocker v1.2.*"
[spam_blocker_1_3_x]: https://img.shields.io/badge/version-1.3.*-blue.svg?style=flat-square "Spam Blocker v1.3.*"
[spam_blocker_1_4_x]: https://img.shields.io/badge/version-1.4.*-blue.svg?style=flat-square "Spam Blocker v1.4.*"

## Composer

Expand All @@ -37,6 +40,8 @@ You can install this package via [Composer](http://getcomposer.org/) by running

### Setup

> **NOTE :** The package will automatically register itself if you're using Laravel `>= v5.5`, so you can skip this section.
Once the package is installed, you can register the service provider in `config/app.php` in the `providers` array:

```php
Expand Down
8 changes: 7 additions & 1 deletion _docs/2.Configuration.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2. Configuration

### Coming Soon…
## Table of contents

1. [Installation and Setup](1.Installation-and-Setup.md)
2. [Configuration](2.Configuration.md)
3. [Usage](3.Usage.md)

> Coming Soon…
8 changes: 7 additions & 1 deletion _docs/3.Usage.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 3. Usage

### Coming Soon…
## Table of contents

1. [Installation and Setup](1.Installation-and-Setup.md)
2. [Configuration](2.Configuration.md)
3. [Usage](3.Usage.md)

> Coming Soon…
20 changes: 15 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"type": "library",
"license": "MIT",
"require": {
"php": ">=5.6.4",
"arcanedev/support": "~4.1.0",
"php": ">=7.0",
"arcanedev/support": "~4.2.0",
"piwik/referrer-spam-blacklist": "~1.0"
},
"require-dev": {
"orchestra/testbench": "~3.4.0",
"phpunit/phpcov": "~3.0",
"phpunit/phpunit": "~5.0"
"orchestra/testbench": "~3.5.0",
"phpunit/phpcov": "~4.0",
"phpunit/phpunit": "~6.0"
},
"autoload": {
"psr-4": {
Expand All @@ -32,5 +32,15 @@
"psr-4": {
"Arcanedev\\SpamBlocker\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Arcanedev\\SpamBlocker\\SpamBlockerServiceProvider"
],
"aliases": {
"SpamBlocker": "Arcanedev\\SpamBlocker\\Facades\\SpamBlocker"
}
}
}
}
4 changes: 2 additions & 2 deletions src/Contracts/SpamBlocker.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface SpamBlocker
/**
* Get the loaded spammers.
*
* @return \Arcanedev\SpamBlocker\Entities\Spammers
* @return \Arcanedev\SpamBlocker\Entities\SpammerCollection
*/
public function spammers();

Expand Down Expand Up @@ -94,7 +94,7 @@ public function block($host);
/**
* Get all spammers (allowed and blocked one).
*
* @return \Arcanedev\SpamBlocker\Entities\Spammers
* @return \Arcanedev\SpamBlocker\Entities\SpammerCollection
*/
public function all();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php namespace Arcanedev\SpamBlocker\Entities;

use Arcanedev\Support\Collection;
use Illuminate\Support\Collection;

/**
* Class Spammers
* Class SpammerCollection
*
* @package Arcanedev\SpamBlocker\Entities
* @author ARCANEDEV <[email protected]>
*/
class Spammers extends Collection
class SpammerCollection extends Collection
{
/* -----------------------------------------------------------------
| Main Methods
Expand Down
15 changes: 8 additions & 7 deletions src/SpamBlocker.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php namespace Arcanedev\SpamBlocker;

use Arcanedev\SpamBlocker\Contracts\SpamBlocker as SpamBlockerContract;
use Arcanedev\SpamBlocker\Entities\Spammers;
use Arcanedev\SpamBlocker\Entities\SpammerCollection;
use Closure;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Cache;

Expand Down Expand Up @@ -42,7 +43,7 @@ class SpamBlocker implements SpamBlockerContract
/**
* The spammers collection.
*
* @var \Arcanedev\SpamBlocker\Entities\Spammers
* @var \Arcanedev\SpamBlocker\Entities\SpammerCollection
*/
protected $spammers;

Expand Down Expand Up @@ -89,7 +90,7 @@ public function __construct(array $config)
/**
* Get the loaded spammers.
*
* @return \Arcanedev\SpamBlocker\Entities\Spammers
* @return \Arcanedev\SpamBlocker\Entities\SpammerCollection
*/
public function spammers()
{
Expand Down Expand Up @@ -185,7 +186,7 @@ public function load()
$this->checkSource();

$this->spammers = $this->cacheSpammers(function () {
return Spammers::load(
return SpammerCollection::load(
file($this->source, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)
);
});
Expand Down Expand Up @@ -228,7 +229,7 @@ public function block($host)
/**
* Get all spammers (allowed and blocked ones).
*
* @return \Arcanedev\SpamBlocker\Entities\Spammers
* @return \Arcanedev\SpamBlocker\Entities\SpammerCollection
*/
public function all()
{
Expand Down Expand Up @@ -350,9 +351,9 @@ protected function resetCache()
*
* @param \Closure $callback
*
* @return \Arcanedev\SpamBlocker\Entities\Spammers
* @return \Arcanedev\SpamBlocker\Entities\SpammerCollection
*/
private function cacheSpammers(\Closure $callback)
private function cacheSpammers(Closure $callback)
{
return Cache::remember($this->cacheKey, $this->cacheExpires, $callback);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?php namespace Arcanedev\SpamBlocker\Tests\Entities;

use Arcanedev\SpamBlocker\Entities\Spammers;
use Arcanedev\SpamBlocker\Entities\SpammerCollection;
use Arcanedev\SpamBlocker\Tests\TestCase;

/**
* Class SpammersTest
* Class SpammerCollectionTest
*
* @package Arcanedev\SpamBlocker\Tests\Entities
* @author ARCANEDEV <[email protected]>
*/
class SpammersTest extends TestCase
class SpammerCollectionTest extends TestCase
{
/* -----------------------------------------------------------------
| Properties
| -----------------------------------------------------------------
*/

/** @var \Arcanedev\SpamBlocker\Entities\Spammers */
/** @var \Arcanedev\SpamBlocker\Entities\SpammerCollection */
private $spammers;

/* -----------------------------------------------------------------
Expand All @@ -28,7 +28,7 @@ public function setUp()
{
parent::setUp();

$this->spammers = new Spammers;
$this->spammers = new SpammerCollection;
}

public function tearDown()
Expand All @@ -48,8 +48,7 @@ public function it_can_be_instantiated()
{
$expectations = [
\Illuminate\Support\Collection::class,
\Arcanedev\Support\Collection::class,
\Arcanedev\SpamBlocker\Entities\Spammers::class,
\Arcanedev\SpamBlocker\Entities\SpammerCollection::class,
];

foreach ($expectations as $expected) {
Expand All @@ -66,7 +65,7 @@ public function it_can_load_spammers()
'spammer-three.com',
];

$this->spammers = Spammers::load($spammers);
$this->spammers = SpammerCollection::load($spammers);

$this->assertCount(count($spammers), $this->spammers);

Expand Down
2 changes: 1 addition & 1 deletion tests/Facades/SpamBlockerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function it_can_get_spammers()
$spammers = SpamBlocker::spammers();

$this->assertInstanceOf(
\Arcanedev\SpamBlocker\Entities\Spammers::class,
\Arcanedev\SpamBlocker\Entities\SpammerCollection::class,
$spammers
);

Expand Down
2 changes: 1 addition & 1 deletion tests/SpamBlockerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function it_can_get_spammers()
$spammers = $this->blocker->spammers();

$this->assertInstanceOf(
\Arcanedev\SpamBlocker\Entities\Spammers::class,
\Arcanedev\SpamBlocker\Entities\SpammerCollection::class,
$spammers
);

Expand Down

0 comments on commit 21b7eff

Please sign in to comment.