Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge 7dca810 into 0682eac
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Aug 27, 2018
2 parents 0682eac + 7dca810 commit 942b632
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion resources/config/laravel-link-checker.php
Expand Up @@ -67,5 +67,5 @@
* Here's an example: [200, 302]
*/
'exclude_status_codes' => [],
]
],
];
10 changes: 5 additions & 5 deletions src/CheckLinksCommand.php
Expand Up @@ -3,10 +3,10 @@
namespace Spatie\LinkChecker;

use Exception;
use Illuminate\Console\Command;
use Spatie\Crawler\Crawler;
use Spatie\Crawler\CrawlObserver;
use Illuminate\Console\Command;
use Spatie\Crawler\CrawlProfile;
use Spatie\Crawler\CrawlObserver;

class CheckLinksCommand extends Command
{
Expand Down Expand Up @@ -67,7 +67,7 @@ protected function getConcurrency(): int
*/
protected function getUrlToBeCrawled()
{
if (!is_null($this->option('url'))) {
if (! is_null($this->option('url'))) {
return $this->option('url');
}

Expand All @@ -87,7 +87,7 @@ protected function getUrlToBeCrawled()
*/
protected function getProfile(): CrawlProfile
{
if (!is_null($this->option('profile'))) {
if (! is_null($this->option('profile'))) {
return app($this->option('profile'));
}

Expand All @@ -103,7 +103,7 @@ protected function getProfile(): CrawlProfile
*/
protected function getReporter(): CrawlObserver
{
if (!is_null($this->option('reporter'))) {
if (! is_null($this->option('reporter'))) {
return app($this->option('reporter'));
}

Expand Down
12 changes: 6 additions & 6 deletions src/Reporters/BaseReporter.php
Expand Up @@ -2,10 +2,10 @@

namespace Spatie\LinkChecker\Reporters;

use GuzzleHttp\Exception\RequestException;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;
use Spatie\Crawler\CrawlObserver;
use Psr\Http\Message\UriInterface;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Exception\RequestException;

abstract class BaseReporter extends CrawlObserver
{
Expand All @@ -32,7 +32,7 @@ public function crawled(
) {
$statusCode = $response->getStatusCode();

if (!$this->isExcludedStatusCode($statusCode)) {
if (! $this->isExcludedStatusCode($statusCode)) {
$this->urlsGroupedByStatusCode[$statusCode][] = $url;
}

Expand All @@ -53,7 +53,7 @@ public function crawlFailed(
) {
$statusCode = $requestException->getCode();

if (!$this->isExcludedStatusCode($statusCode)) {
if (! $this->isExcludedStatusCode($statusCode)) {
$this->urlsGroupedByStatusCode[$statusCode][] = $url;
}

Expand All @@ -78,7 +78,7 @@ protected function isSuccessOrRedirect($statusCode): bool
protected function crawledBadUrls(): bool
{
return collect($this->urlsGroupedByStatusCode)->keys()->filter(function ($statusCode) {
return !$this->isSuccessOrRedirect($statusCode);
return ! $this->isSuccessOrRedirect($statusCode);
})->count() > 0;
}

Expand Down
6 changes: 2 additions & 4 deletions src/Reporters/LogBrokenLinks.php
Expand Up @@ -2,10 +2,9 @@

namespace Spatie\LinkChecker\Reporters;

use GuzzleHttp\Exception\RequestException;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;
use Psr\Log\LoggerInterface;
use Psr\Http\Message\UriInterface;
use GuzzleHttp\Exception\RequestException;

class LogBrokenLinks extends BaseReporter
{
Expand Down Expand Up @@ -38,7 +37,6 @@ public function finishedCrawling()
}

$this->log->warning("Crawled {$count} url(s) with statuscode {$statusCode}");

});
}

Expand Down
6 changes: 3 additions & 3 deletions src/Reporters/MailBrokenLinks.php
Expand Up @@ -2,10 +2,10 @@

namespace Spatie\LinkChecker\Reporters;

use GuzzleHttp\Exception\RequestException;
use Psr\Http\Message\UriInterface;
use Illuminate\Contracts\Mail\Mailer;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\UriInterface;
use GuzzleHttp\Exception\RequestException;

class MailBrokenLinks extends BaseReporter
{
Expand All @@ -29,7 +29,7 @@ public function __construct(Mailer $mail)
*/
public function finishedCrawling()
{
if (!$this->crawledBadUrls()) {
if (! $this->crawledBadUrls()) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/IntegrationTest.php
Expand Up @@ -2,9 +2,9 @@

namespace Spatie\LinkChecker\Test;

use Spatie\Crawler\Crawler;
use Illuminate\Support\Facades\Log;
use Orchestra\Testbench\TestCase as Orchestra;
use Spatie\Crawler\Crawler;
use Spatie\LinkChecker\LinkCheckerServiceProvider;

abstract class IntegrationTest extends Orchestra
Expand Down

0 comments on commit 942b632

Please sign in to comment.