X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Fdrupalmoduleupgrader%2Fsrc%2FUtility%2FFilter%2FFieldValueFilter.php;fp=web%2Fmodules%2Fcontrib%2Fdrupalmoduleupgrader%2Fsrc%2FUtility%2FFilter%2FFieldValueFilter.php;h=63d9af9187734100ea547b69dec0d5f6c0948e8c;hp=0000000000000000000000000000000000000000;hb=8acec36f19c470dfcda1ae2336826a782f41874c;hpb=e0411c4e83ba0d079034db83c3f7f55be24a0e35 diff --git a/web/modules/contrib/drupalmoduleupgrader/src/Utility/Filter/FieldValueFilter.php b/web/modules/contrib/drupalmoduleupgrader/src/Utility/Filter/FieldValueFilter.php new file mode 100644 index 000000000..63d9af918 --- /dev/null +++ b/web/modules/contrib/drupalmoduleupgrader/src/Utility/Filter/FieldValueFilter.php @@ -0,0 +1,45 @@ +bar[LANGUAGE_NONE][0]['value']. This filter doesn't guarantee that + * matched nodes actually ARE field accesses -- just that they have the proper + * formation (S-foils in attack formation!...what, you don't like Star Wars?) + */ +class FieldValueFilter { + + /** + * @var string + */ + protected $variable; + + public function __construct($variable) { + $this->variable = $variable; + } + + /** + * @return boolean + */ + public function __invoke(Node $node) { + if ($node instanceof ArrayLookupNode) { + $root = $node->getRootArray(); + + if ($root instanceof ObjectPropertyNode) { + $object = $root->getObject(); + + if ($object instanceof VariableNode && $object->getName() == $this->variable) { + return (sizeof($node->getKeys()) >= 3); + } + } + } + return FALSE; + } + +}