Set a single space before a node.

@param Node $node
Node to set space before.
162678
protected function spaceBefore(Node $node) {
    $prev = $node->previousToken();
    if ($prev instanceof WhitespaceNode) {
      $prev->setText(' ');
    }
    else {
      $node->before(Token::space());
    }
  }
835990
public function removeNode(\Ydle\HubBundle\Entity\Node $node)
    {
        $this->nodes->removeElement($node);
    }
210387
public function enterNode(Node $node)
    {
        parent::enterNode($node);

        if (self::isConditional($node)) {
            $this->conditionalScopes++;
        } elseif ($node instanceof Function_) {
            $name = $this->getFullyQualifiedName($node->name);

            // @todo add an "else" here which adds a runtime check for instances where we can't tell
            // whether a function is being redefined by static analysis alone.
            if ($this->conditionalScopes === 0) {
                if (\function_exists($name) ||
                    isset($this->currentScope[\strtolower($name)])) {
                    $msg = \sprintf('Cannot redeclare %s()', $name);
                    throw new FatalErrorException($msg, 0, E_ERROR, null, $node->getLine());
                }
            }

            $this->currentScope[\strtolower($name)] = true;
        }
    }
601658
public function isAllowedOnGlobalSpace (PhpParser\Node $node) 
    {
        return (
                $node instanceof Stmt\Class_
                || $node instanceof Stmt\Function_
                || $node instanceof Stmt\Trait_ 
                || ($node instanceof Stmt\UseUse || $node instanceof Stmt\Use_)
                || ($node instanceof Stmt\Namespace_ || $node instanceof Node\Name)
                || $node instanceof Stmt\Interface_
            );
    }
120447
private function isPrimitive(Node $node) {
		return $node instanceof String_
			|| $node instanceof LNumber
			|| $node instanceof DNumber
			|| $this->isBool($node)
			|| $this->isNull($node);
	}
105613
public function before($nodes) {
    foreach ($this->nodes as $i => $node) {
      $node->before($i === 0 ? $nodes : clone $nodes);
    }
    return $this;
  }
1198226
public function prepend(?Node $node): bool {
        if ($node === null) {
            return false;
        }
        /*
         * need to clone the object otherwise the object
         * references are going crazy.
         *
         * Furthermore, setting previous and next to null
         * as they will be set later.
         */
        $newNode = clone $node;
        $newNode->setPrevious(null);
        $newNode->setNext(null);

        if ($this->getHead() === null) {
            $this->setHead($newNode);
            return true;
        }
        $head = $this->getHead();
        $head->setPrevious($newNode);
        $newNode->setNext($head);
        $this->setHead($newNode);
        return true;
    }
1049687
public function setNode(?string $node): NodeAwareDefinitionInterface
    {
        if ($node && !preg_match('/\w+/', $node)) {
            throw new \InvalidArgumentException('Invalid node name');
        }

        $this->node = $node;

        return $this;
    }
806230
public function leaveNode(Node $node)
    {
        if ($node instanceof Node\Stmt\ClassLike) {
            if (!$node->name) {
                return;
            }
            if (!$this->getAdt()->hasDeclaredGlobalNamespace()) {
                throw new Error('DeclaredNamespace is already defined', $node->getLine());
            }
            $this->collect(new Node\Name($node->namespacedName), $node);
        }
    }
58204
public function enterNode(Node $node)
    {
        if ($node instanceof Namespace_) {
            $this->namespace = isset($node->name) ? $node->name->parts : [];
        }
    }
263440
public function enterNode(Node $node)
    {
        parent::enterNode($node);

        if (self::isConditional($node)) {
            $this->conditionalScopes++;
        } else {
            // @todo add an "else" here which adds a runtime check for instances where we can't tell
            // whether a class is being redefined by static analysis alone.
            if ($this->conditionalScopes === 0) {
                if ($node instanceof Class_) {
                    $this->validateClassStatement($node);
                } elseif ($node instanceof Interface_) {
                    $this->validateInterfaceStatement($node);
                } elseif ($node instanceof Trait_) {
                    $this->validateTraitStatement($node);
                }
            }
        }
    }
115727
public function insert(Node $node) : void
    {
        $node->setParent($this->scope);
        $this->scope->insert($node);
    }
1273021
protected function prependChild(Node $node) {
    if ($this->head === NULL) {
      $this->childCount++;
      $node->parent = $this;
      $node->previous = NULL;
      $node->next = NULL;
      $this->head = $this->tail = $node;
    }
    else {
      $this->insertBeforeChild($this->head, $node);
      $this->head = $node;
    }
    return $this;
  }
603965
public function addChildAsLast(Node $node)
    {
        if(null === $this->children)
        {
            $this->children = array();
        }

        $this->children[] = $node;
    }
380234
public function leaveNode(Node $node)
    {
        if ($node instanceof ClassMethod && $node->name === $this->nodeName) {
            // Build arguments.
            $args = [];
            foreach ($this->args as $arg) {
                $args[] = new Arg(
                    is_string($arg)
                        ? new String_($arg)
                        : (is_float($arg)
                            ? new DNumber($arg)
                            : new LNumber($arg)
                        ) 
                );
            }
            // ADD comment
            $nop = new Nop;
            $nop->setAttribute('comments', [
                new Comment(sprintf('// Ayuco: addition %s', date('Y-m-d h:i a')))
            ]);
            $node->stmts[] = $nop;
            // ADD statement
            $node->stmts[] = new MethodCall(
                empty($this->variable) ? null : new Variable($this->variable),
                $this->methodName,
                $args
            );
        }
    }
157904
public function load($node = NULL) {
		if ($node instanceof \DOMNode) {
			$this->node = $node;
		} else {
			$dom = new \DOMDocument();
			$dom->preserveWhiteSpace = FALSE;
			$dom->strictErrorChecking = FALSE;
			if (@$dom->loadHTML($node)) {
				$this->node = $dom;
			} else {
				throw new \Exception('load html error');
			}
		}
	}
1024431
protected function handleBlocks(Node $node)
    {

        $this->blocks = $node->findArray('block');
        foreach ($this->blocks as $blockNode)
            $this->handleBlock($blockNode);

        return $this;
    }