/** * {@inheritdoc} */ public function add(NodeInterface $node) { /** @var \Pharborist\Functions\FunctionDeclarationNode|\Pharborist\Functions\FunctionCallNode $node */ $fields = ['id' => (string) $node->getName(), 'file' => $node->getFilename(), 'type' => get_class($node)]; if ($node instanceof FunctionDeclarationNode) { $logical = new ContainsLogicFilter(); $logical->whitelist('t'); $logical->whitelist('drupal_get_path'); $fields['has_logic'] = (int) $node->is($logical); } $this->db->insert($this->table)->fields($fields)->execute(); }
/** * {@inheritdoc} */ public function add(NodeInterface $node) { $fields = ['file' => $node->getFilename(), 'type' => get_class($node)]; if ($node instanceof ClassNode) { $fields['id'] = (string) $node->getName(); $fields['parent'] = (string) $node->getExtends(); } elseif ($node instanceof NewNode) { $fields['id'] = (string) $node->getClassName(); } else { throw new \InvalidArgumentException('Unexpected node type (expected ClassNode or NewNode).'); } $this->db->insert($this->table)->fields($fields)->execute(); }
/** * {@inheritdoc} */ public function add(NodeInterface $node) { $this->db->insert($this->table)->fields(['id' => (string) $node->getName(), 'file' => $node->getFilename()])->execute(); }