Function to determine if an event has been finished.

@param \Drupal\node\Entity\Node $node
The event.

@return bool
TRUE if the evens is finished / completed.
484436
protected function eventHasBeenFinished(Node $node) {
    // Use the start date when the end date is not set to determine if the
    // event is closed.
    /** @var \Drupal\Core\Datetime\DrupalDateTime $check_end_date */
    $check_end_date = $node->field_event_date->date;

    if (isset($node->field_event_date_end->date)) {
      $check_end_date = $node->field_event_date_end->date;
    }

    $current_time = new DrupalDateTime();

    // The event has finished if the end date is smaller than the current date.
    if ($current_time > $check_end_date) {
      return TRUE;
    }
    return FALSE;
  }
1157213
public function hasProperty(Node $node = null, $property) {
        if (!isset($node))
            return false;
        
        return ($node->getProperty($this->expand($property)) != null);
    }
727466
public function isFunctionCall($node, string $function): Bool
    {
        if ($node instanceof Node && $node->kind === \ast\AST_CALL) {
            $expr = $node->children['expr'];

            if ($expr->kind === \ast\AST_NAME && $expr->children['name'] === $function) {
                return true;
            }
        }

        return false;
    }
612371
public function apply(AbstractNode $node)
    {
        if (!$this->isFactory($node)) {
            return;
        }

        if ($this->isMethodDeprecated($node)) {
            return;
        }

        $this->applyRule($node);
    }
1013120
protected function isEntity(ClassNode $node)
    {
        $docComment = $node->getDocComment();

        if (0 < preg_match($this->getStringProperty('classIsEntityRegex'), $docComment)) {
            return true;
        }

        if (true === $node->isAbstract()) {
            return false;
        }

        if (0 < preg_match($this->getStringProperty('entityRegex'), $docComment)) {
            return true;
        }

        return false;
    }
24730
private function isChildOfTry(AbstractNode $node)
    {
        $parent = $node->getParent();

        while (is_object($parent)) {
            if ($parent->isInstanceOf('TryStatement')) {
                return true;
            }

            $parent = $parent->getParent();
        }

        return false;
    }
1213664
public function leaveNode(Node $node)
    {
        if ($node instanceof Node\FunctionLike) {
            foreach ($node->params as $param) {
                if ($param->variadic) {
                    $vParam = array_pop($node->params);
                    $node->stmts = $this->addFuncGetArgs(
                        $node->stmts,
                        $node->params,
                        $vParam
                    );
                    $node->params = [];
                    return;
                }
            }
        }
    }
1084745
private function _visitNode($node)
    {
        $this->_nodeStates[$node->name] = self::IN_PROGRESS;

        if (isset($this->_relatedClasses[$node->name])) {
            foreach ($this->_relatedClasses[$node->name] as $relatedNode) {
                if ($this->_nodeStates[$relatedNode->name] == self::NOT_VISITED) {
                    $this->_visitNode($relatedNode);
                }
            }
        }

        $this->_nodeStates[$node->name] = self::VISITED;
        $this->_sorted[] = $node;
    }
1004170
private function deleteNode( $node ) {
		$this->deleteChildren( $node );
		$parent = $node->parentNode;
		$oldnode = $parent->removeChild( $node );
	}
585589
private function _isContainSelector($node)
    {
        if ($node->hasAttribute($this->_attrName)) {
            $attr = $node->getAttribute($this->_attrName);
            $len = strlen($this->_value);
            if ($len > 0) {
                $pos = strpos($attr, $this->_value);
                return $pos !== false;
            }
        }

        return false;
    }
550079
protected function isRed(?RedBlackNode $node): bool
    {
        if ($node === null) {
            return false;
        }

        return $node->color() === RedBlackNode::RED;
    }
1301349
public function isNodeBlacklisted(NodeInterface $node) : bool
    {
        return $this->nodeTypeBlacklist && isset($this->nodeTypeBlacklist[$node->bundle()]);
    }
833117
private function isBool(Node $node) {
		if ($node instanceof ConstFetch) {
			$const = $node->name->parts[0];
			if (isset($this->constMap[$const])) {
				return is_bool($this->constMap[$const]);
			}
	
			return is_bool($const);
		}
	}
1052617
public function isEnded(ResourceNode $resourceNode): bool
    {
        return !empty($resourceNode->getAccessibleUntil()) && $resourceNode->getAccessibleUntil() <= new \DateTime();
    }
1076523
function it_compiles_nodes($node)
    {
        $node->compile($this)->will(function ($args) {
            $args[0]->write('echo $message');
        });

        $this->compile($node)->getSource()->shouldMatch('/\Recho \$message/');
    }
133619
private function isOurNode($node)
    {
        foreach ($this->createdNodes as $createdNode) {
            if ($createdNode == $node) {
                return true;
            }
        }
        return false;
    }
147621
public function removeNode(Node $node = null) : bool
    {
        if (!$node) {
            return true;
        }
        // flag for GC
        unset($this->list[$node->key], $this->keyList[$node->key], $this->idList[$node->id]);

        return true;
    }