for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the PHP Translation package.
*
* (c) PHP Translation team <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Translation\Extractor\Visitor\Php;
use PhpParser\Node;
use Translation\Extractor\Visitor\BaseVisitor;
/**
* Base class for PHP visitors.
* @author Tobias Nyholm <[email protected]>
abstract class BasePHPVisitor extends BaseVisitor
{
protected function getStringArgument(Node\Expr\MethodCall $node, int $index): ?string
if (!isset($node->args[$index])) {
return null;
}
if (!$node->args[$index]->value instanceof Node\Scalar\String_) {
$label = $node->args[$index]->value->value;
if (empty($label)) {
return $label;