mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 13:35:54 +00:00
wip
This commit is contained in:
27
app/Client/Support/TokenNodeVisitor.php
Normal file
27
app/Client/Support/TokenNodeVisitor.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Client\Support;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
|
||||
class TokenNodeVisitor extends NodeVisitorAbstract
|
||||
{
|
||||
/** @var string */
|
||||
protected $token;
|
||||
|
||||
public function __construct(string $token)
|
||||
{
|
||||
$this->token = $token;
|
||||
}
|
||||
|
||||
public function enterNode(Node $node)
|
||||
{
|
||||
if ($node instanceof Node\Expr\ArrayItem && $node->key->value === 'auth_token') {
|
||||
$node->value->value = $this->token;
|
||||
|
||||
return $node;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user