relations() public static method

Returns a list of models related to Model, or a list of models related to this model, but of a certain type.
public static relations ( string $type = null ) : array | object | void
$type string A type of model relation.
return array | object | void An array of relation instances or an instance of relation.
 /**
  * Returns a list of models related to `Model`, or a list of models related
  * to this model, but of a certain type. Overwritten to return all/original/alternate relations
  *
  * @param string $name A type of model relation.
  * @param string $type Specify all, original, alternate
  * @return array An array of relation types.
  */
 public static function relations($name = null, $type = 'original')
 {
     if ($type == 'all' || $type == 'alternate') {
         $self = static::_object();
         if ($type == 'all') {
             $relations = array_merge($self->_relations, $self->_alternateRelations);
         } else {
             $relations = $self->_alternateRelations;
         }
         if (!$name) {
             return $relations;
         }
         if (isset($relations[$name])) {
             return $relations[$name];
         }
         if (isset($self->_relationTypes[$name])) {
             return array_keys(array_filter($relations, function ($i) use($name) {
                 return $i->data('type') == $name;
             }));
         }
     }
     return parent::relations($name);
 }