Skip to content

Commit

Permalink
tv tools 2 (#1489)
Browse files Browse the repository at this point in the history
* styling

* misc
  • Loading branch information
TomasVotruba authored Sep 13, 2024
1 parent 7df9fbe commit ad53e3c
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 74 deletions.
125 changes: 66 additions & 59 deletions resources/views/tools.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,88 +19,95 @@
</p>
</div>

<br>
<br>

<div class="row">

@foreach ($tools as $tool)
<div class="col-12 col-lg-6">
<div class="col-12 col-md-8 offset-md-2">
<div class="card mb-5 shadow">
<div class="card-body ps-4 pe-4">
<a name="{{ $tool->getSlug() }}"></a>
<div class="card-body ps-4 pe-4">
<a name="{{ $tool->getSlug() }}"></a>

<a href="{{ $tool->getLink() }}" class="me-2" style="text-decoration: none;">
<div class="badge text-bg-dark">GitHub</div>
</a>
<div style="float: left; margin-top: .2em" class="text-secondary">
<a href="#{{ $tool->getSlug() }}">
#{{ $loop->index + 1 }}
</a>
</div>

@if ($tool->getPost())
<div class="badge text-bg-success me-2">
<a href="{{ $tool->getPost() }}" style="color: white">Read Blog Post</a>
<div class="text-end">
@if ($tool->isPhpstanExtension())
<div class="badge text-bg-warning">PHPStan extension</div>
@else
<div class="badge text-bg-primary">Standalone CLI tool</div>
@endif
</div>
@endif

@if ($tool->isPhpstanExtension())
<div class="badge text-bg-warning">PHPStan extension</div>
@endif

<h2 class="mt-5" style="font-size: 2em; margin-bottom: 1.1em">{{ $tool->getName() }}</h2>

<p class="mt-5">
<em class="text-secondary">Why use?</em>
</p>
<p>
{{ $tool->getWhy() }}
</p>
<h2 class="text-center" style="font-size: 2em; margin: 2.5em 0;">{{ $tool->getName() }}</h2>

<br>
<p class="mt-5">
<em class="text-secondary">Why use?</em>
</p>
<p>
{{ $tool->getWhy() }}

<p>
<em class="text-secondary">Best time to start using?</em>
</p>
<p>
{{ $tool->getWhen() }}
</p>
</div>
@if ($tool->getPost())
<span class="ps-2 pe-2">•</span>
<a href="{{ $tool->getPost() }}">Read&nbsp;more in a post</a>
@endif
</p>

<div class="card-body border-top border-primary border-bottom bg-primary-subtle">
<div class="form-floating m-2">
<textarea class="form-control border border-primary">{{ $tool->getComposer() }}</textarea>
<label>Install</label>
</div>
</div>
<br>

@if ($tool->getTryCommands())
<div class="card-body mt-2 mb-2 ms-2">
<em class="text-secondary">First commands to try</em>
</div>
<p>
<em class="text-secondary">Best time to start using?</em>
</p>
<p>
{{ $tool->getWhen() }}
</p>

<br>

<p>
<em class="text-secondary">How to install?</em>
<textarea class="form-control mt-2" style="height: 2.5em; max-width: 40em">{{ $tool->getComposer() }}</textarea>
</p>

<br>

@foreach ($tool->getTryCommands() as $label => $tryCommand)
<div class="card-body border-top border-success bg-success-subtle">
<div class="form-floating m-2">
<textarea class="form-control border border-success">{{ $tryCommand }}</textarea>
<label>{{ $label }}</label>
@if ($tool->getTryCommands())
<p>
<em class="text-secondary">First commands to try</em>

<div class="card-body rounded bg-light border" style="border-color: #DDD;">
@foreach ($tool->getTryCommands() as $label => $tryCommand)
<div class="form-floating m-2">
<textarea class="form-control">{{ $tryCommand }}</textarea>
<label>{{ $label }}</label>

@if (! $loop->last)<br>@endif
</div>
@endforeach
</div>
</div>
@endforeach
@endif
</p>
@endif

@if ($tool->getPhpstanContents())
<div class="card-body mt-2 mb-2 ms-2">
<em class="text-secondary">Copy-paste to <code>phpstan.neon</code></em>
</div>
@if ($tool->getPhpstanContents())
<p>
<em class="text-secondary">Copy-paste to <code>phpstan.neon</code></em>

<div class="card-body border-top border-success bg-success-subtle">
<div class="m-2">
<textarea class="form-control border border-success autoresize">{{ $tool->getPhpstanContents() }}</textarea>
</div>
</div>
@endif
<div class="card-body rounded bg-light border" style="border-color: #DDD;">
<textarea class="form-control border autoresize m-2" style="max-width: 32.8em">{{ $tool->getPhpstanContents() }}</textarea>
</div>
</p>
@endif
</div>
</div>
</div>

@endforeach

</div>
</div>

<script>
Expand Down
10 changes: 1 addition & 9 deletions src/Repository/ToolRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public function fetchAll(): array
'Easy Coding Standard',
'First week when you come to a new project',
'Adds advanced coding standard fast',
'https://github.com/easy-coding-standard/easy-coding-standard',
'https://tomasvotruba.com/blog/introducing-up-to-16-times-faster-easy-coding-standard',
'composer require symplify/easy-coding-standard --dev',
[
Expand All @@ -32,7 +31,6 @@ public function fetchAll(): array
'Type Coverage',
'When you reach PHP 7.0+ with scalar types',
'Helps you add type declarations 1 % at a time',
'https://github.com/TomasVotruba/type-coverage',
'https://tomasvotruba.com/blog/how-to-measure-your-type-coverage',
'composer require tomasvotruba/type-coverage --dev',
[],
Expand All @@ -52,8 +50,7 @@ public function fetchAll(): array
$tools[] = new Tool(
'Class Leak',
'When you reach PHPStan level 2',
'Spots unused classes',
'https://github.com/TomasVotruba/class-leak',
'Spots unused classes you can remove',
'https://tomasvotruba.com/blog/how-to-avoid-maintaining-classes-you-dont-use',
'composer require tomasvotruba/class-leak --dev',
[
Expand All @@ -65,7 +62,6 @@ public function fetchAll(): array
'Unused public',
'When you reach PHPStan level 3/4',
'Removes unused public code you maintain',
'https://github.com/TomasVotruba/unused-public',
'https://tomasvotruba.com/blog/can-phpstan-find-dead-public-methods/',
'composer require tomasvotruba/unused-public --dev',
[],
Expand All @@ -84,7 +80,6 @@ public function fetchAll(): array
'Composer Dependency Analyser',
'When you reach PHPStan level 2/3',
'Detect unused dependencies, transitional dependencies, missing classes and more',
'https://github.com/shipmonk-rnd/composer-dependency-analyser',
'',
'composer require shipmonk/composer-dependency-analyser --dev',
[
Expand All @@ -96,7 +91,6 @@ public function fetchAll(): array
'Swiss Knife',
'When you reach PHPStan level 3/4',
'Finalizes classes without children, makes class constants private and more',
'https://github.com/rectorphp/swiss-knife',
'https://tomasvotruba.com/blog/cool-features-of-swiss-knife',
'composer require rector/swiss-knife --dev',
[
Expand All @@ -109,7 +103,6 @@ public function fetchAll(): array
'Type Perfect',
'When you reach PHPStan level 6',
'Help you remove mixed types from obviously known code',
'https://github.com/rectorphp/type-perfect',
'https://getrector.com/blog/introducing-type-perfect-for-extra-safety',
'composer require rector/type-perfect --dev',
[],
Expand All @@ -129,7 +122,6 @@ public function fetchAll(): array
'Config Transformer',
'When you have Symfony configs in YAML',
'Converts YAML configs to PHP for you',
'https://github.com/symplify/config-transformer',
'https://tomasvotruba.com/blog/2020/07/27/how-to-switch-from-yaml-xml-configs-to-php-today-with-migrify/',
'composer require symplify/config-transformer --dev',
[
Expand Down
6 changes: 0 additions & 6 deletions src/ValueObject/Tool.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public function __construct(
private string $name,
private string $when,
private string $why,
private string $link,
private string $post,
private string $composer,
private array $tryCommands = [],
Expand All @@ -41,11 +40,6 @@ public function getWhy(): string
return $this->why;
}

public function getLink(): string
{
return $this->link;
}

public function getPost(): ?string
{
return $this->post;
Expand Down

0 comments on commit ad53e3c

Please sign in to comment.