L.php in Drupal 7 to 8/9 Module Upgrader 8        
                          
                  
                        
  
  
  
  
  
File
  src/Plugin/DMU/Converter/Functions/L.php
  
    View source  
  <?php
namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions;
use Drupal\drupalmoduleupgrader\TargetInterface;
use Pharborist\Functions\FunctionCallNode;
use Pharborist\Objects\ClassMethodCallNode;
use Pharborist\Parser;
use Pharborist\Types\StringNode;
class L extends URL {
  
  public function rewrite(FunctionCallNode $call, TargetInterface $target) {
    $arguments = $call
      ->getArguments();
    if ($arguments[1] instanceof StringNode) {
      
      $url = Parser::parseSnippet('url(' . $arguments[1] . ');')
        ->firstChild();
      $url_rewritten = parent::rewrite($url, $target);
      if ($url_rewritten) {
        return ClassMethodCallNode::create('\\Drupal\\Core\\Link', 'fromTextAndUrl')
          ->appendArgument($arguments[0])
          ->appendArgument($url_rewritten);
      }
    }
  }
}
 
Classes
        
  
  
      
      
         
      
                  
            Name            | 
                  
            Description           | 
              
    
    
          
                  | 
            L           | 
                  
            Plugin annotation
@Converter(
 id = "l",
 description = @Translation("Rewrites calls to l()."),
 fixme = @Translation("l() expects a Url object, created from a route name or external URI."),
 dependencies = { "router.route_provider" }
)           |