Skip to content

Commit

Permalink
TabPluginInterface: Send value along with representation
Browse files Browse the repository at this point in the history
  • Loading branch information
jnvsor committed Nov 16, 2024
1 parent 745dd36 commit 7d3314f
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 9 deletions.
Binary file modified build/kint.phar
Binary file not shown.
3 changes: 2 additions & 1 deletion src/Renderer/Rich/BinaryPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

namespace Kint\Renderer\Rich;

use Kint\Value\AbstractValue;
use Kint\Value\Representation\BinaryRepresentation;
use Kint\Value\Representation\RepresentationInterface;

Expand All @@ -37,7 +38,7 @@ class BinaryPlugin extends AbstractPlugin implements TabPluginInterface
/** @psalm-var positive-int */
public static int $chunk_length = 0x2;

public function renderTab(RepresentationInterface $r): ?string
public function renderTab(RepresentationInterface $r, AbstractValue $v): ?string
{
if (!$r instanceof BinaryRepresentation) {
return null;
Expand Down
3 changes: 2 additions & 1 deletion src/Renderer/Rich/CallableDefinitionPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
namespace Kint\Renderer\Rich;

use Kint\Utils;
use Kint\Value\AbstractValue;
use Kint\Value\Representation\CallableDefinitionRepresentation;
use Kint\Value\Representation\RepresentationInterface;

class CallableDefinitionPlugin extends AbstractPlugin implements TabPluginInterface
{
public function renderTab(RepresentationInterface $r): ?string
public function renderTab(RepresentationInterface $r, AbstractValue $v): ?string
{
if (!$r instanceof CallableDefinitionRepresentation) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/Rich/ColorPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function renderValue(AbstractValue $v): ?string
return '<dl>'.$header.$children.'</dl>';
}

public function renderTab(RepresentationInterface $r): ?string
public function renderTab(RepresentationInterface $r, AbstractValue $v): ?string
{
if (!$r instanceof ColorRepresentation) {
return null;
Expand Down
3 changes: 2 additions & 1 deletion src/Renderer/Rich/MicrotimePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@
namespace Kint\Renderer\Rich;

use Kint\Utils;
use Kint\Value\AbstractValue;
use Kint\Value\Representation\MicrotimeRepresentation;
use Kint\Value\Representation\RepresentationInterface;

class MicrotimePlugin extends AbstractPlugin implements TabPluginInterface
{
public function renderTab(RepresentationInterface $r): ?string
public function renderTab(RepresentationInterface $r, AbstractValue $v): ?string
{
if (!$r instanceof MicrotimeRepresentation || !($dt = $r->getDateTime())) {
return null;
Expand Down
3 changes: 2 additions & 1 deletion src/Renderer/Rich/ProfilePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@

namespace Kint\Renderer\Rich;

use Kint\Value\AbstractValue;
use Kint\Value\Representation\ProfileRepresentation;
use Kint\Value\Representation\RepresentationInterface;

class ProfilePlugin extends AbstractPlugin implements TabPluginInterface
{
public function renderTab(RepresentationInterface $r): ?string
public function renderTab(RepresentationInterface $r, AbstractValue $v): ?string
{
if (!$r instanceof ProfileRepresentation) {
return null;
Expand Down
3 changes: 2 additions & 1 deletion src/Renderer/Rich/SourcePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@

namespace Kint\Renderer\Rich;

use Kint\Value\AbstractValue;
use Kint\Value\Representation\RepresentationInterface;
use Kint\Value\Representation\SourceRepresentation;

class SourcePlugin extends AbstractPlugin implements TabPluginInterface
{
public function renderTab(RepresentationInterface $r): ?string
public function renderTab(RepresentationInterface $r, AbstractValue $v): ?string
{
if (!$r instanceof SourceRepresentation) {
return null;
Expand Down
3 changes: 2 additions & 1 deletion src/Renderer/Rich/TabPluginInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@

namespace Kint\Renderer\Rich;

use Kint\Value\AbstractValue;
use Kint\Value\Representation\RepresentationInterface;

interface TabPluginInterface extends PluginInterface
{
public function renderTab(RepresentationInterface $r): ?string;
public function renderTab(RepresentationInterface $r, AbstractValue $v): ?string;
}
2 changes: 1 addition & 1 deletion src/Renderer/Rich/TablePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TablePlugin extends AbstractPlugin implements TabPluginInterface
{
public static bool $respect_str_length = true;

public function renderTab(RepresentationInterface $r): ?string
public function renderTab(RepresentationInterface $r, AbstractValue $v): ?string
{
if (!$r instanceof TableRepresentation) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/RichRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ protected function calledFrom(): string
protected function renderTab(AbstractValue $v, RepresentationInterface $rep): string
{
if ($plugin = $this->getTabPlugin($rep)) {
$output = $plugin->renderTab($rep);
$output = $plugin->renderTab($rep, $v);
if (null !== $output) {
return $output;
}
Expand Down

0 comments on commit 7d3314f

Please sign in to comment.