Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / Plugin / DMU / Converter / Functions / DB.php
1 <?php
2
3 namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions;
4
5 use Drupal\drupalmoduleupgrader\TargetInterface;
6 use Pharborist\Functions\FunctionCallNode;
7 use Pharborist\Types\StringNode;
8
9 /**
10  * @Converter(
11  *  id = "_db",
12  *  deriver = "\Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions\DBDeriver"
13  * )
14  */
15 class DB extends FunctionCallModifier {
16
17   /**
18    * Tables which will cause the function call to be commented out.
19    *
20    * @var string[]
21    */
22   protected static $forbiddenTables = ['system', 'variable'];
23
24   /**
25    * {@inheritdoc}
26    */
27   public function rewrite(FunctionCallNode $call, TargetInterface $target) {
28     $table = $call->getArgumentList()->getItem(0);
29     return ($table instanceof StringNode && in_array($table->toValue(), self::$forbiddenTables)) ? NULL : $call;
30   }
31
32 }