Emits a "Node Adopt" event

@param NodeInterface $node
@param Context $context
@param $recursive
@return void
514271
public function beforeAdoptNode(NodeInterface $node, Context $context, $recursive)
    {
        if (!$this->eventEmittingService->isEnabled()) {
            return;
        }

        if ($this->currentlyAdopting === 0) {
            /* @var $nodeEvent NodeEvent */
            $nodeEvent = $this->eventEmittingService->emit(self::NODE_ADOPT, [
                'targetWorkspace' => $context->getWorkspaceName(),
                'targetDimensions' => $context->getTargetDimensions(),
                'recursive' => $recursive
            ], NodeEvent::class);
            $nodeEvent->setNode($node);
            $this->eventEmittingService->pushContext();
        }

        $this->currentlyAdopting++;
    }
337778
public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
    {
        Assert::isInstanceOf($application, Flow::class, sprintf('Flow application needed for PublishResourcesTask, got "%s"', get_class($application)));

        if ($application->getVersion() >= '3.0') {
            $targetPath = $deployment->getApplicationReleasePath($application);
            $this->shell->executeOrSimulate($application->buildCommand($targetPath, 'resource:publish'), $node, $deployment);
        }
    }
779287
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Expr || ! $parent instanceof VariableLikeInterface) {
            throw new Exception('ValueNodeParser is made to parse a expression node');
        }
    }
535053
public function markChildren($node, $context=null, $childrenMethod='AllChildrenIncludingDeleted', $numChildrenMethod='numChildren') {
        if($node->hasMethod($childrenMethod)) {
            $children=$node->$childrenMethod($context);
        }else {
            user_error(sprintf("Can't find the method '%s' on class '%s' for getting tree children", $childrenMethod, get_class($node)), E_USER_ERROR);
        }
        
        $node->markExpanded();
        if($children) {
            foreach($children as $child) {
                if(!$this->markingFilter || $this->markingFilterMatches($child)) {
                    if($child->$numChildrenMethod()) {
                        $child->markUnexpanded();
                    }else {
                        $child->markExpanded();
                    }
                    
                    $this->markedNodes[$child->ClassName.'_'.$child->ID]=$child;
                }
            }
        }
    }
900536
public function enterNode(NodeInterface $node): VisitorResult
    {
        $schema = $this->typeInfo->getSchema();

        if ($node instanceof SelectionSetNode) {
            $namedType = getNamedType($this->typeInfo->getType());
            $this->typeInfo->pushParentType($namedType instanceof CompositeTypeInterface ? $namedType : null);
        } elseif ($node instanceof FieldNode) {
            $parentType      = $this->typeInfo->getParentType();
            $fieldDefinition = null;
            $fieldType       = null;
            if (null !== $parentType) {
                $fieldDefinition = $this->typeInfo->resolveFieldDefinition($schema, $parentType, $node);
                if (null !== $fieldDefinition) {
                    $fieldType = $fieldDefinition->getType();
                }
            }
            $this->typeInfo->pushFieldDefinition($fieldDefinition);
            $this->typeInfo->pushType(isOutputType($fieldType) ? $fieldType : null);
        } elseif ($node instanceof DirectiveNode) {
            $this->typeInfo->setDirective($schema->getDirective($node->getNameValue()));
        } elseif ($node instanceof OperationDefinitionNode) {
            $type      = null;
            $operation = $node->getOperation();
            if ($operation === 'query') {
                $type = $schema->getQueryType();
            } elseif ($operation === 'mutation') {
                $type = $schema->getMutationType();
            } elseif ($operation === 'subscription') {
                $type = $schema->getSubscriptionType();
            }
            $this->typeInfo->pushType($type instanceof ObjectType ? $type : null);
        } elseif ($node instanceof InlineFragmentNode || $node instanceof FragmentDefinitionNode) {
            $typeCondition = $node->getTypeCondition();
            $outputType    = null !== $typeCondition
                ? TypeASTConverter::convert($schema, $typeCondition)
                : getNamedType($this->typeInfo->getType());
            $this->typeInfo->pushType(isOutputType($outputType) ? $outputType : null);
        } elseif ($node instanceof VariableDefinitionNode) {
            $inputType = TypeASTConverter::convert($schema, $node->getType());
            /** @noinspection PhpParamsInspection */
            $this->typeInfo->pushInputType(isInputType($inputType) ? $inputType : null);
        } elseif ($node instanceof ArgumentNode) {
            $argumentType       = null;
            $argumentDefinition = null;
            $fieldOrDirective   = $this->typeInfo->getDirective() ?: $this->typeInfo->getFieldDefinition();
            if (null !== $fieldOrDirective) {
                $argumentDefinition = find(
                    $fieldOrDirective->getArguments(),
                    function (Argument $argument) use ($node) {
                        return $argument->getName() === $node->getNameValue();
                    }
                );
                if (null !== $argumentDefinition) {
                    $argumentType = $argumentDefinition->getType();
                }
            }
            $this->typeInfo->setArgument($argumentDefinition);
            $this->typeInfo->pushInputType(isInputType($argumentType) ? $argumentType : null);
        } elseif ($node instanceof ListValueNode) {
            $listType = getNullableType($this->typeInfo->getInputType());
            $itemType = $listType instanceof ListType ? $listType->getOfType() : $listType;
            $this->typeInfo->pushInputType(isInputType($itemType) ? $itemType : null);
        } elseif ($node instanceof ObjectFieldNode) {
            $objectType     = getNamedType($this->typeInfo->getInputType());
            $inputFieldType = null;
            if ($objectType instanceof InputObjectType) {
                $fields     = $objectType->getFields();
                $inputField = $fields[$node->getNameValue()] ?? null;
                if (null !== $inputField) {
                    $inputFieldType = $inputField->getType();
                }
            }
            /** @noinspection PhpParamsInspection */
            $this->typeInfo->pushInputType(isInputType($inputFieldType) ? $inputFieldType : null);
        } elseif ($node instanceof EnumValueNode) {
            $enumType  = getNamedType($this->typeInfo->getInputType());
            $enumValue = null;
            if ($enumType instanceof EnumType) {
                $enumValue = $enumType->getValue($node->getValue());
            }
            $this->typeInfo->setEnumValue($enumValue);
        }

        return $this->visitor->enterNode($node);
    }
424408
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Stmt\Property || ! $parent instanceof TraitModelInterface) {
            throw new Exception('AttributeNodeParser is made to parse a property node');
        }
        $isStatic   = $node->isStatic();
        $visibility = AttributeVisibilityHelper::getVisibility($node);

        foreach ($node->props as $property) {
            $attribute = new AttributeModel();
            $attribute->setParentNode($parent);
            $attribute->setName($property->name);
            $attribute->setIsStatic($isStatic);
            $attribute->setVisibility($visibility);

            if ($property->default !== null) {
                $this->valueNodeParser->invoke($property->default, $attribute);
            }

            $parent->addAttribute($attribute);
        }
    }
1104727
public function add(NodeInterface $node)
	{
		$max = $this->getMax();
		$node->setLeftValue($max + 1);
		$node->setRightValue($max + 2);
		$node->setLevel(0);
	}
538737
public function invoke($node, NodeInterface $parent): void
    {
        if ($this->config->hasInterfaceParsing()) {
            if (! $node instanceof Node\Stmt\Interface_ || ! $parent instanceof PhpFileModelInterface) {
                throw new Exception('InterfaceNodeParser is made to parse an interface node');
            }

            $interface = new InterfaceModel();
            $interface->setParentNode($parent);
            $interface->setName(ClassLikeNameHelper::getName($node));
            $parent->addConcreteUse($parent->getFullNameFor($interface->getName()), $interface->getName());

            if (($documentation = $node->getDocComment()) !== null) {
                $this->documentationNodeParser->invoke($documentation, $interface);
            }

            $this->parseSubNodes($node->stmts, $interface);

            $parent->addInterface($interface);
        }
    }
429179
protected function interruptNode(NodeInterface $node)
    {
        // if we have an interruptNodeId, bubble up until we match a node
        // else stop propagation
        return $this->interruptNodeId ? $this->interruptNodeId !== $node->getId() : false;
    }
177354
public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
    {
        // Get nodes
        if (empty($options['sourceNode']) || !is_array($options['sourceNode'])) {
            throw new InvalidConfigurationException('No sourceNode given in options.', 1409078366);
        }
        $sourceNode = $this->nodeFactory->getNodeByArray($options['sourceNode']);
        $localNode = $deployment->getNode('localhost');
        $targetNode = $node;

        // Get shared paths
        $sourceSharedPath = $this->getSharedPathFromNode(
            $sourceNode,
            $deployment,
            $options['sourceNodeOptions'],
            $application
        );
        $localSharedPath = $deployment->getWorkspacePath($application).'_shared/';
        $targetSharedPath = $this->getSharedPathFromNode($node, $deployment, $options, $application);

        // maybe we should change this behaviour ...
        if ($targetNode->isLocalhost() === true || $sourceNode->isLocalhost() === true) {
            // sync direct
            $this->sync($sourceNode, $sourceSharedPath, $targetNode, $targetSharedPath, $deployment, $options);
        } else {
            // cached
            $this->sync($sourceNode, $sourceSharedPath, $localNode, $localSharedPath, $deployment, $options);
            $this->sync($localNode, $localSharedPath, $targetNode, $targetSharedPath, $deployment, $options);
        }
    }
192354
public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
    {
        if (!isset($options['folders'])) {
            return;
        }
        $folders = $options['folders'];
        if (!is_array($folders)) {
            $folders = [$folders];
        }
        $replacePaths = [
            '{deploymentPath}' => escapeshellarg($application->getDeploymentPath()),
            '{sharedPath}' => escapeshellarg($application->getSharedPath()),
            '{releasePath}' => escapeshellarg($deployment->getApplicationReleasePath($application)),
            '{currentPath}' => escapeshellarg($application->getReleasesPath() . '/current'),
            '{previousPath}' => escapeshellarg($application->getReleasesPath() . '/previous')
        ];

        $commands = [];

        $username = isset($options['username']) ? $options['username'] . '@' : '';
        $hostname = $node->getHostname();
        $port = $node->hasOption('port') ? '-P ' . escapeshellarg($node->getOption('port')) : '';

        foreach ($folders as $folderPair) {
            if (!is_array($folderPair) || count($folderPair) !== 2) {
                throw new InvalidConfigurationException('Each rsync folder definition must be an array of exactly two folders', 1405599056);
            }
            $sourceFolder = rtrim(str_replace(array_keys($replacePaths), $replacePaths, $folderPair[0]), '/') . '/';
            $targetFolder = rtrim(str_replace(array_keys($replacePaths), $replacePaths, $folderPair[1]), '/') . '/';
            $commands[] = "rsync -avz --delete -e ssh {$sourceFolder} {$username}{$hostname}:{$targetFolder}";
        }

        $ignoreErrors = isset($options['ignoreErrors']) && $options['ignoreErrors'] === true;
        $logOutput = !(isset($options['logOutput']) && $options['logOutput'] === false);

        $localhost = new Node('localhost');
        $localhost->onLocalhost();

        $this->shell->executeOrSimulate($commands, $localhost, $deployment, $ignoreErrors, $logOutput);
    }
178996
public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
    {
        $this->executeOrSimulate($node, $application, $deployment, $options);
    }
1019073
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Stmt\Namespace_ || ! $parent instanceof PhpFileModelInterface) {
            throw new Exception('NamespaceNodeParser is made to parse a namespace node');
        }

        if ($node->name instanceof Node\Name) {
            $parent->setNamespace($node->name->parts);
        }

        $this->preParseUses($node->stmts, $parent);

        $this->parseSubNodes($node->stmts, $parent);
    }
535509
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Stmt\Class_ || ! $parent instanceof PhpFileModelInterface) {
            throw new Exception('ClassNodeParser is made to parse a class node');
        }
        $class = new ClassModel();
        $class->setParentNode($parent);
        $class->setName(ClassLikeNameHelper::getName($node));
        $class->setIsAbstract($node->isAbstract());
        $class->setIsFinal($node->isFinal());
        $parent->addConcreteUse($parent->getFullNameFor($class->getName()), $class->getName());

        if (($documentation = $node->getDocComment()) !== null) {
            $this->documentationNodeParser->invoke($documentation, $class);
        }

        $this->parseSubNodes($node->stmts, $class);

        $parent->addClass($class);
    }
533800
public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
    {
        $options = $this->configureOptions($options);

        $host = $options['releaseHost'];
        $login = $options['releaseHostLogin'];
        $changeLogUri = $options['changeLogUri'];
        $sitePath =  $options['releaseHostSitePath'];
        $version = $options['version'];
        $productName = $options['productName'];

        $this->shell->executeOrSimulate(sprintf('ssh %s%s "cd \"%s\" ; ./flow release:release --product-name \"%s\" --version \"%s\" --change-log-uri \"%s\""', ($login ? $login . '@' : ''), $host, $sitePath, $productName, $version, ($changeLogUri ? $changeLogUri : '')), $node, $deployment);
    }
172298
public function visit($query, $node, string $context)
    {
        if ($node instanceof $this->node) {
            $child0 = $node->getChildByIndex(0);
            $child1 = $node->getChildByIndex(1);

            if ($context === Nodes\OrNode::class) {
                $query->orWhere($this->parseNode($query, $child0), $this->operator, $this->parseNode($query, $child1));
            }

            if ($context === Nodes\AndNode::class) {
                $query->where($this->parseNode($query, $child0), $this->operator, $this->parseNode($query, $child1));
            }
        }
    }
872304
public function execute(Node $node, Application $application, Deployment $deployment, array $options = [])
    {
        $targetPath = $deployment->getApplicationReleasePath($application);
        $this->shell->executeOrSimulate(
            'cd '.$targetPath.' && FLOW_CONTEXT='.$options['context'].' ./flow typo3.flow:cache:flush',
            $node,
            $deployment
        );
    }