@param null $type
@param null $direction

@return \Neoxygen\NeoClient\Formatter\Relationship[]
425929
public function getRelationships($type = null, $direction = null)
    {
        if (null === $direction) {
            $relationships = array_merge($this->inboundRelationships, $this->outboundRelationships);
        } else {
            $dir = strtoupper($direction);
            if (!in_array($direction, array('IN', 'OUT'))) {
                throw new \InvalidArgumentException(sprintf('The direction "%s" is not valid', $direction));
            }
            $relationships = ('IN' === $dir) ? $this->getInboundRelationships() : $this->getOutboundRelationships();
        }

        if (null === $type) {
            return $relationships;
        }

        $collection = array();
        foreach ($relationships as $rel) {
            if ($rel->getType() === $type) {
                $collection[] = $rel;
            }
        }

        return $collection;
    }
840810
public function adjacentSibling($direction = 1)
    {
        $parent = $this->parent();
        $collection = $parent ? $parent->collection('content', false) : null;
        if ($collection instanceof Collection) {
            return $collection->adjacentSibling($this->path(), $direction);
        }

        return false;
    }
194244
private Map<String, RelationshipResult> getCache(final Direction direction) {

		final String directionKey             = direction != null ? direction.name() : "*";
		Map<String, RelationshipResult> cache = relationshipCache.get(directionKey);

		if (cache == null) {

			cache = new HashMap<>();
			relationshipCache.put(directionKey, cache);
		}

		return cache;
	}
986450
public function getStructure(string $type = null): array
    {
        return [
            'email' => $this->makeField(trans('HCCore::users.label.email'))
                ->email()
                ->isRequired()
                ->toArray(),
        ];
    }
421615
public function sortByDefault(string $direction = 'asc'): TableListColumn
    {
        // we check if the method has already been called
        if ($this->getAttribute('tableList')->sortBy || $this->getAttribute('tableList')->sortDir) {
            $errorMessage = 'The « sortByDefault() » method has already been called. '
                            . 'You only can sort a column by default once.';
            throw new ErrorException($errorMessage);
        }
        // we set the sort attribute
        $this->getAttribute('tableList')->sortBy = $this->getAttribute('attribute');
        // we set the sort direction
        $acceptedDirections = ['asc', 'desc'];
        $errorMessage = 'Invalid « $direction » argument for « sortByAttribute() » method. Has to be « asc » or '
                        . '« desc ». « ' . $direction . ' » given.';
        if (! in_array($direction, $acceptedDirections)) {
            throw new InvalidArgumentException($errorMessage);
        }
        $this->getAttribute('tableList')->setAttribute('sortDir', $direction);

        return $this;
    }
456469
public function orderBy($fields, string $direction = 'ASC'): IQueryBuilderHandler
    {
        if (\is_array($fields) === false) {
            $fields = [$fields];
        }

        foreach ((array)$fields as $key => $value) {
            $field = $key;
            $type = $value;

            if (\is_int($key) === true) {
                $field = $value;
                $type = $direction;
            }

            if (($field instanceof Raw) === false) {
                $field = $this->addTablePrefix($field);
            }

            $this->statements['orderBys'][] = compact('field', 'type');
        }

        return $this;
    }
890457
public function getRealDirection($direction)
    {
        if ($direction == 'in' || $direction == 'out')
        {
            $direction = ucfirst($direction);

        } elseif ($direction == 'any')
        {
            $direction = 'All';

        } else
        {
            throw new UnknownDirectionException($direction);
        }

        $direction = "Direction". $direction;

        return constant("Everyman\Neo4j\Relationship::". $direction);
    }
1312248
public function order($direction = null)
    {
        if (is_null($direction)) {
            $direction = $this->getOrderDirection();
        } else {
            $this->setOrderDirection($direction);
        }

        // if a direction is set
        if (!empty($direction)) {
            if (!is_string($this->order) && is_callable($this->order)) {
                call_user_func_array($this->order, $this);
            } else {

                $table = $this->getTable();

                // verify that source is a query
                if (!$table->isSourceQueryBuilder()) {
                    throw new \Exception('Table source is not an instance of query builder');
                }

                $table->getSource()->orderBy($this->order, $direction);
            }
        }

        return $this;
    }
1233565
private function eventQuery(string $direction)
    {
        return DB::table('dates')
            ->select(['d_gid as id', 'd_year as year', 'd_fact AS fact', 'd_type AS type'])
            ->where('d_file', '=', $this->tree->id())
            ->where('d_gid', '<>', 'HEAD')
            ->whereIn('d_fact', $this->getCommonFacts())
            ->where('d_julianday1', '<>', 0)
            ->orderBy('d_julianday1', $direction)
            ->orderBy('d_type')
            ->first();
    }
311404
public function buildSortClosure($propertyPath, $direction)
    {
        $value = function ($data) use ($propertyPath) {
            return $this->propertyAccessor->getValue($data, $propertyPath);
        };

        if ($direction === Util\ColumnSort::ASC) {
            return function ($rowA, $rowB) use ($value) {
                $a = $value($rowA);
                $b = $value($rowB);

                if ($a == $b) {
                    return 0;
                }

                return $a < $b ? -1 : 1;
            };
        } elseif ($direction === Util\ColumnSort::DESC) {
            return function ($rowA, $rowB) use ($value) {
                $a = $value($rowA);
                $b = $value($rowB);

                if ($a == $b) {
                    return 0;
                }

                return $a > $b ? -1 : 1;
            };
        }

        throw new Exception\InvalidArgumentException("Unexpected column sort direction.");
    }
803828
public static function fromString(string $direction): Direction
    {
        if($direction == self::IN ) {
            return self::in();
        } else if($direction == self::OUT) {
            return self::out();
        } else {
            throw new Exceptions\InvalidDirectionException($direction);
        }
    }
878500
public function getDependencies($type = null)
    {
        if (empty($this->getDatabaseContainer()->getDatabase()->getDependencies())) {
            return false;
        }

        if (!empty($type)) {
            return $this->getDatabaseContainer()->getDatabase()->getDependencies()->{'get' . $type}();
        }

        $array = [];

        $hasOne = $this->getDatabaseContainer()->getDatabase()->getDependencies()->getHasOne();
        if (!empty($hasOne)) {
            $array = array_merge(
                $array,
                array_values($hasOne)
            );
        }

        $hasMany = $this->getDatabaseContainer()->getDatabase()->getDependencies()->getHasMany();
        if (!empty($hasMany)) {
            $array = array_merge(
                $array,
                array_values($hasMany)
            );
        }

        return !empty($array) ? $array : false;
    }
382495
public function cascade($models, $direction, array $directionData = [])
    {
        try {
            $this->direction = $direction;
            $this->directionData = $directionData;
            $this->run($models);
            //All ok we commit all database queries
            foreach ($this->dbsToTransact as $connectionToTransact) {
                DB::connection($connectionToTransact)->commit();
            }
        } catch (\Exception $e) {
            //Rollback the transaction before throw exception
            foreach ($this->dbsToTransact as $connectionToTransact) {
                DB::connection($connectionToTransact)->rollBack();
            }

            throw new SoftCascadeLogicException($e->getMessage(), null, $e);
        }
    }
642701
public function getDenormalizationFieldMappings(string $path, string $type = null): array
    {
        return $this->getMapping()->getDenormalizationFieldMappings($path, $type);
    }
1099096
public static function relations($type = null) {
		$self = static::_object();

		if ($type === null) {
			return static::_relations();
		}
		if (isset($self->_relationFieldNames[$type])) {
			$type = $self->_relationFieldNames[$type];
		}

		if (isset($self->_relations[$type])) {
			return $self->_relations[$type];
		}
		if (isset($self->_relationsToLoad[$type])) {
			return static::_relations(null, $type);
		}
		if (in_array($type, $self->_relationTypes, true)) {
			return array_keys(static::_relations($type));
		}
	}
175498
public function first(Model $parentModel, Model $relatedModel, $type, $direction = 'any')
    {
        // First we get the first relationship instance between the two models
        // absed on the given direction.
        $relation = $this->firstRelation($parentModel, $relatedModel, $type, $direction);

        // Let's stop here if there is no relationship between them.
        if (is_null($relation)) return null;

        // Now we can return the determined edge out of the relation and direction.
        return $this->edgeFromRelationWithDirection($relation, $parentModel, $relatedModel, $direction);
    }
1159066
public function skipTypes($tokenTypes, $direction = self::DIR_FORWARD)
    {
        return $this->safeMove(function () use ($tokenTypes, $direction) {
            $this->moveWithCondition(function () use ($tokenTypes) {
                return in_array($this->current()->getType(), $tokenTypes);
            }, $direction);

            return $this;
        });
    }