Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 0 additions & 10 deletions resources/views/_snippets/menu_items.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ class="nav-link">Find Rule</a>
@endif
</li>

<li class="nav-item">
<a href="{{ action(\App\Controller\InteractiveController::class) }}"
class="nav-link">Play & Learn</a>
@if (!isset($includeFooterLinks))
<div class="badge text-white bg-danger"
style="float:right; margin-top: -4.7em; margin-right: -.3em; font-size: .6em">NEW
</div>
@endif
</li>

<li class="nav-item">
<a href="{{ action(\App\Controller\ContactController::class) }}"
class="nav-link">Contact</a>
Expand Down
4 changes: 2 additions & 2 deletions resources/views/homepage/find_rule.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

@section('main')
<div id="filter" class="mt-4" style="min-height: 30em">
<p class="mb-3">
Find the best Rector rule to solve your problem
<p class="mb-4">
Find the best Rector rule to solve your problem. Searching through {{ $ruleCount }} rules.
</p>

@livewire('find-rule-component')
Expand Down
14 changes: 12 additions & 2 deletions resources/views/livewire/find-rule-component.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,17 @@ class="form-select ms-3"

<div class="clearfix mb-2"></div>

<br>

@if ($isFilterActive)
<p>
@if ($filteredRules === 0)
No rule found. Try changing group to more generic one, or use different query.
@elseif (count($filteredRules) === 1)
Found 1 rule. That's the one:
@else
Found <strong>{{ count($filteredRules) }} rules</strong>:
@endif
</p>

@foreach ($filteredRules as $filteredRule)
<div style="--bs-border-opacity: .5;" class="mb-3 mt-2 card
@if ($filteredRule->isConfigurable())
Expand Down Expand Up @@ -130,6 +138,8 @@ class="language-diff">{{ $filteredRule->getDiffCodeSample() }}</code></pre>
<p>No rules found. Try different query.</p>
@endif
@else
<br>

<p>Not sure how to search? Try one of these for a start:</p>

<ul>
Expand Down
7 changes: 7 additions & 0 deletions src/Controller/FindRuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@

namespace App\Controller;

use App\FileSystem\RectorFinder;
use Illuminate\Contracts\View\View;
use Illuminate\Routing\Controller;

final class FindRuleController extends Controller
{
public function __construct(
private RectorFinder $rectorFinder
) {
}

public function __invoke(): View
{
return \view('homepage/find_rule', [
'page_title' => 'Find the best Rule',
'ruleCount' => $this->rectorFinder->getRuleCount(),
]);
}
}
5 changes: 5 additions & 0 deletions src/FileSystem/RectorFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,9 @@ private function findInDirectoriesAndCreateRuleMetadatas(array $directories, arr

return $ruleMetadatas;
}

public function getRuleCount(): int
{
return count($this->findCore()) + count($this->findCommunity());
}
}
Loading