mirror of
https://github.com/bitinflow/expose.git
synced 2026-03-13 21:45:55 +00:00
wip
This commit is contained in:
28
app/Client/Support/InsertDefaultServerNodeVisitor.php
Normal file
28
app/Client/Support/InsertDefaultServerNodeVisitor.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Client\Support;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\ConstFetch;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
|
||||
class InsertDefaultServerNodeVisitor extends NodeVisitorAbstract
|
||||
{
|
||||
public function leaveNode(Node $node)
|
||||
{
|
||||
if ($node instanceof Node\Expr\ArrayItem && $node->key && $node->key->value === 'auth_token') {
|
||||
$defaultServerNode = new Node\Expr\ArrayItem(
|
||||
new ConstFetch(
|
||||
new Name('null')
|
||||
),
|
||||
new Node\Scalar\String_('default_server')
|
||||
);
|
||||
|
||||
return [
|
||||
$node,
|
||||
$defaultServerNode,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user